diff mbox series

[-next,resend] media: ar0521: fix error return code in ar0521_power_on()

Message ID 20220917071432.1544323-1-yangyingliang@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next,resend] media: ar0521: fix error return code in ar0521_power_on() | expand

Commit Message

Yang Yingliang Sept. 17, 2022, 7:14 a.m. UTC
Return error code if ar0521_write_regs() fails in ar0521_power_on().

Fixes: 852b50aeed15 ("media: On Semi AR0521 sensor driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
---
  +cc: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/i2c/ar0521.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Sakari Ailus Sept. 20, 2022, 11:49 a.m. UTC | #1
On Sat, Sep 17, 2022 at 03:14:32PM +0800, Yang Yingliang wrote:
> Return error code if ar0521_write_regs() fails in ar0521_power_on().
> 
> Fixes: 852b50aeed15 ("media: On Semi AR0521 sensor driver")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> Acked-by: Krzysztof Hałasa <khalasa@piap.pl>

This is already in my pull request to Mauro.
diff mbox series

Patch

diff --git a/drivers/media/i2c/ar0521.c b/drivers/media/i2c/ar0521.c
index c7bdfc69b9be..e850c92d847e 100644
--- a/drivers/media/i2c/ar0521.c
+++ b/drivers/media/i2c/ar0521.c
@@ -757,8 +757,9 @@  static int ar0521_power_on(struct device *dev)
 	usleep_range(4500, 5000); /* min 45000 clocks */
 
 	for (cnt = 0; cnt < ARRAY_SIZE(initial_regs); cnt++)
-		if (ar0521_write_regs(sensor, initial_regs[cnt].data,
-				      initial_regs[cnt].count))
+		ret = ar0521_write_regs(sensor, initial_regs[cnt].data,
+					initial_regs[cnt].count);
+		if (ret)
 			goto off;
 
 	ret = ar0521_write_reg(sensor, AR0521_REG_SERIAL_FORMAT,