* [PATCH] media: i2c: dw9719: power down on detection errors
@ 2026-09-13 4:18 Myeonghun Pak
0 siblings, 0 replies; only message in thread
From: Myeonghun Pak @ 2026-09-13 4:18 UTC (permalink / raw)
To: Daniel Scally, Sakari Ailus, Mauro Carvalho Chehab
Cc: Hans de Goede, linux-media, linux-kernel, stable, Ijae Kim
Moving chip detection into dw9719_power_up() introduced direct returns
after the regulator has been enabled. An INFO register read failure or an
unrecognized ID bypasses the power-down path, while probe only cleans up
the media entity and controls after a power-up error.
Route both detection errors through the existing power-down check. Preserve
the read error or -ENXIO and leave the successful power-up and regulator
enable failure paths unchanged.
This issue was identified during our ongoing static-analysis research while
reviewing kernel code.
Fixes: 2a1551665a85 ("media: dw9719: Add DW9761 support")
Cc: stable@vger.kernel.org
Assisted-by: OpenAI:GPT-5.6
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
drivers/media/i2c/dw9719.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/dw9719.c b/drivers/media/i2c/dw9719.c
index 3b7ba88fd..8a34abe18 100644
--- a/drivers/media/i2c/dw9719.c
+++ b/drivers/media/i2c/dw9719.c
@@ -150,7 +150,7 @@ static int dw9719_power_up(struct dw9719_device *dw9719, bool detect)
ret = cci_read(dw9719->regmap, DW9719_INFO, &val, NULL);
if (ret < 0)
- return ret;
+ goto out;
switch (val) {
case DW9719_ID:
@@ -168,7 +168,8 @@ static int dw9719_power_up(struct dw9719_device *dw9719, bool detect)
default:
dev_err(dw9719->dev,
"Error unknown device id 0x%02llx\n", val);
- return -ENXIO;
+ ret = -ENXIO;
+ goto out;
}
props:
@@ -218,6 +219,7 @@ static int dw9719_power_up(struct dw9719_device *dw9719, bool detect)
cci_write(dw9719->regmap, DW9719_VCM_FREQ, dw9719->vcm_freq, &ret);
}
+out:
if (ret)
dw9719_power_down(dw9719);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-13 4:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-13 4:18 [PATCH] media: i2c: dw9719: power down on detection errors Myeonghun Pak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®