Browse Source

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 <[email protected]>
Dikshita Agarwal 4 years ago
parent
commit
167aebba8c
1 changed files with 4 additions and 0 deletions
  1. 4 0
      driver/vidc/src/msm_vidc.c

+ 4 - 0
driver/vidc/src/msm_vidc.c

@@ -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);