From: David Carlier <devnexen@gmail.com>
To: hpa@redhat.com
Cc: sakari.ailus@linux.intel.com, mchehab@kernel.org,
tarang.raval@siliconsignals.io, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org, David Carlier <devnexen@gmail.com>
Subject: [PATCH] media: i2c: imx471: Fix uninitialized error value in imx471_set_ctrl()
Date: Fri, 24 Jul 2026 05:14:16 +0100 [thread overview]
Message-ID: <20260724041417.9921-1-devnexen@gmail.com> (raw)
The exposure control write passes the address of the local ret variable
to cci_write() as its error pointer while ret is still uninitialized.
cci_write() returns early without touching the hardware when the error
value it is handed is already non-zero, so a non-zero garbage value on
the stack silently skips programming the exposure register and makes the
control write return a bogus, possibly positive, status.
This path runs on every stream start and on every exposure update from
userspace. Initialize ret to zero so the exposure register is always
written and a correct status is returned.
Fixes: be1589e567ae ("media: i2c: imx471: Add Sony IMX471 image sensor driver")
Signed-off-by: David Carlier <devnexen@gmail.com>
---
drivers/media/i2c/imx471.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/imx471.c b/drivers/media/i2c/imx471.c
index 6d358b11e96d..5aca5f2355d6 100644
--- a/drivers/media/i2c/imx471.c
+++ b/drivers/media/i2c/imx471.c
@@ -306,7 +306,7 @@ static int imx471_set_ctrl(struct v4l2_ctrl *ctrl)
v4l2_subdev_get_locked_active_state(&sensor->sd);
const struct v4l2_mbus_framefmt *format =
v4l2_subdev_state_get_format(state, 0);
- int ret;
+ int ret = 0;
if (ctrl->id == V4L2_CID_VBLANK) {
s64 exposure_max = format->height + ctrl->val -
--
2.53.0
reply other threads:[~2026-07-24 4:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260724041417.9921-1-devnexen@gmail.com \
--to=devnexen@gmail.com \
--cc=hpa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tarang.raval@siliconsignals.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.