mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: i2c: vgxy61: Fix an error handling path in vgxy61_detect()
@ 2024-10-03 17:53 Christophe JAILLET
  2024-10-07 12:36 ` Benjamin Mugnier
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2024-10-03 17:53 UTC (permalink / raw)
  To: Benjamin Mugnier, Sylvain Petinot, Sakari Ailus,
	Mauro Carvalho Chehab, Julien Massot
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-media

If cci_read() fails, 'st' is set to 0 in cci_read(), so we return success,
instead of the expected error code.

Fix it and return the expected error.

Fixes: 9a6d7f2ba2b9 ("media: i2c: st-vgxy61: Convert to CCI register access helpers")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/media/i2c/vgxy61.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/vgxy61.c b/drivers/media/i2c/vgxy61.c
index 30378e962016..8034e21051be 100644
--- a/drivers/media/i2c/vgxy61.c
+++ b/drivers/media/i2c/vgxy61.c
@@ -1617,7 +1617,7 @@ static int vgxy61_detect(struct vgxy61_dev *sensor)
 
 	ret = cci_read(sensor->regmap, VGXY61_REG_NVM, &st, NULL);
 	if (ret < 0)
-		return st;
+		return ret;
 	if (st != VGXY61_NVM_OK)
 		dev_warn(&client->dev, "Bad nvm state got %u\n", (u8)st);
 
-- 
2.46.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: i2c: vgxy61: Fix an error handling path in vgxy61_detect()
  2024-10-03 17:53 [PATCH] media: i2c: vgxy61: Fix an error handling path in vgxy61_detect() Christophe JAILLET
@ 2024-10-07 12:36 ` Benjamin Mugnier
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Mugnier @ 2024-10-07 12:36 UTC (permalink / raw)
  To: Christophe JAILLET, Sylvain Petinot, Sakari Ailus,
	Mauro Carvalho Chehab, Julien Massot
  Cc: linux-kernel, kernel-janitors, linux-media

Hi Christophe,

Thank you for your patch.

On 10/3/24 19:53, Christophe JAILLET wrote:
> If cci_read() fails, 'st' is set to 0 in cci_read(), so we return success,
> instead of the expected error code.
> 
> Fix it and return the expected error.
> 
> Fixes: 9a6d7f2ba2b9 ("media: i2c: st-vgxy61: Convert to CCI register access helpers")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>

> ---
>  drivers/media/i2c/vgxy61.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/vgxy61.c b/drivers/media/i2c/vgxy61.c
> index 30378e962016..8034e21051be 100644
> --- a/drivers/media/i2c/vgxy61.c
> +++ b/drivers/media/i2c/vgxy61.c
> @@ -1617,7 +1617,7 @@ static int vgxy61_detect(struct vgxy61_dev *sensor)
>  
>  	ret = cci_read(sensor->regmap, VGXY61_REG_NVM, &st, NULL);
>  	if (ret < 0)
> -		return st;
> +		return ret;
>  	if (st != VGXY61_NVM_OK)
>  		dev_warn(&client->dev, "Bad nvm state got %u\n", (u8)st);
>  

-- 
Regards,

Benjamin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-07 12:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-03 17:53 [PATCH] media: i2c: vgxy61: Fix an error handling path in vgxy61_detect() Christophe JAILLET
2024-10-07 12:36 ` Benjamin Mugnier

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®