media: i2c: imx471: Fix uninitialized error value in imx471_set_ctrl()

The exposure and vertical blanking writes pass the address of the local
ret variable to cci_write() as its error pointer, but there is no earlier
error to propagate: each case is a single standalone write, like the other
controls in the same switch that already pass NULL. In the exposure case
ret is still uninitialized, so a non-zero stack value makes cci_write()
return early without programming the register, and the control write
reports a bogus status. The vertical blanking case is benign today because
ret is zero there, but the construct is equally wrong.

Pass NULL as the error pointer in both cases.

Fixes: be1589e567 ("media: i2c: imx471: Add Sony IMX471 image sensor driver")
Suggested-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: David Carlier <devnexen@gmail.com>
Reviewed-by: Kate Hsuan <hpa@redhat.com>
Reviewed-by: Tarang Raval <tarang.raval@siliconsignals.io>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
This commit is contained in:
David Carlier 2026-07-28 10:24:30 +01:00 committed by Sakari Ailus
parent 7b1734e176
commit b272a1780e

View File

@ -334,12 +334,12 @@ static int imx471_set_ctrl(struct v4l2_ctrl *ctrl)
break;
case V4L2_CID_EXPOSURE:
ret = cci_write(sensor->regmap, IMX471_REG_EXPOSURE,
ctrl->val, &ret);
ctrl->val, NULL);
break;
case V4L2_CID_VBLANK:
/* Update FLL that meets expected vertical blanking */
ret = cci_write(sensor->regmap, IMX471_REG_FLL,
format->height + ctrl->val, &ret);
format->height + ctrl->val, NULL);
break;
case V4L2_CID_TEST_PATTERN:
ret = cci_write(sensor->regmap, IMX471_REG_TEST_PATTERN,