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 Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak --- 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);