video: driver:: handle NULL value of ctrl

In case, when control id passed by client is 0, ctrl ref will be NULL.
handle such NULL ctrl by returning -EINVAL from driver.

Fix: v4l2-compliance: testSimpleControls: Invalid Control.

Change-Id: Ie7dfe96775dd5fe71a4e467539dd261e4ba9efaf
Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
This commit is contained in:
Dikshita Agarwal
2021-05-31 16:57:57 +05:30
committed by Gerrit - the friendly Code Review server
parent fc3bb7608f
commit 167aebba8c

View File

@@ -379,7 +379,11 @@ int msm_vidc_g_ctrl(void *instance, struct v4l2_control *control)
rc = msm_vidc_get_control(inst, ctrl);
if (!rc)
control->value = ctrl->val;
} else {
i_vpr_e(inst, "%s: invalid control\n", __func__);
return -EINVAL;
}
if (rc)
i_vpr_e(inst, "%s: failed for control id %#x\n",
__func__, control->id);