hal: fix return value checks while getting HDMI info
Fix error check conditions in functions related to
retrieval of HDMI sink capabilities.
CRs-Fixed: 2574040
Change-Id: Ia4cdf2fbb35601858de456a0da70d967d63375bb
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index b28e763..18384fb 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1957,9 +1957,10 @@
reset_hdmi_sink_caps(out);
/* Cache ext disp type */
- if (platform_get_ext_disp_type_v2(adev->platform,
+ ret = platform_get_ext_disp_type_v2(adev->platform,
out->extconn.cs.controller,
- out->extconn.cs.stream <= 0)) {
+ out->extconn.cs.stream);
+ if(ret < 0) {
ALOGE("%s: Failed to query disp type, ret:%d", __func__, ret);
return -EINVAL;
}
@@ -4863,7 +4864,7 @@
err = platform_get_controller_stream_from_params(parms, &ext_controller,
&ext_stream);
- if (err >= 0) {
+ if (err == 0) {
out->extconn.cs.controller = ext_controller;
out->extconn.cs.stream = ext_stream;
ALOGD("%s: usecase(%s) new controller/stream (%d/%d)", __func__,
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 985de83..3f28f79 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -6002,7 +6002,7 @@
}
disp_type = mixer_ctl_get_value(ctl, 0);
- if (disp_type == EXT_DISPLAY_TYPE_NONE) {
+ if (disp_type <= EXT_DISPLAY_TYPE_NONE) {
ALOGE("%s: Invalid external display type: %d", __func__, disp_type);
return -EINVAL;
}