[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <xbmwlnflzhfhapyt5dinqqsdurxgu5imlqixudopb7z32eteth@cs7hulza54e3>
Date: Wed, 27 Aug 2025 14:58:14 +0200
From: Jacopo Mondi <jacopo.mondi@...asonboard.com>
To: Qianfeng Rong <rongqianfeng@...o.com>
Cc: Jacopo Mondi <jacopo@...ndi.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>, Mauro Carvalho Chehab <mchehab@...nel.org>,
"open list:MT9V111 APTINA CAMERA SENSOR" <linux-media@...r.kernel.org>, open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/5] media: i2c: mt9v111: fix incorrect type for ret
Hi Qianfeng
On Wed, Aug 27, 2025 at 08:39:10PM +0800, Qianfeng Rong wrote:
> Change "ret" from unsigned int to int type in mt9v111_calc_frame_rate()
> to store negative error codes or zero returned by __mt9v111_hw_reset()
> and other functions.
>
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but it's ugly as pants.
>
> No effect on runtime.
well, I'm not sure that's true.
The code goes as
ret = __mt9v111_hw_reset(mt9v111);
if (ret == -EINVAL)
ret = __mt9v111_sw_reset(mt9v111);
if (ret)
return ret;
And if ret is unsigned the condition ret == -EINVAL will never be met.
I guess this actually fixes a bug, doesn't it ?
>
> Signed-off-by: Qianfeng Rong <rongqianfeng@...o.com>
You can add:
Cc: stable@...r.kernel.org
Fixes: aab7ed1c3927 ("media: i2c: Add driver for Aptina MT9V111")
Reviewed-by: Jacopo Mondi <jacopo.mondi@...asonboard.com>
Thanks
j
> ---
> drivers/media/i2c/mt9v111.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/mt9v111.c b/drivers/media/i2c/mt9v111.c
> index 6aa80b504168..9d724a7cd2f5 100644
> --- a/drivers/media/i2c/mt9v111.c
> +++ b/drivers/media/i2c/mt9v111.c
> @@ -532,8 +532,8 @@ static int mt9v111_calc_frame_rate(struct mt9v111_dev *mt9v111,
> static int mt9v111_hw_config(struct mt9v111_dev *mt9v111)
> {
> struct i2c_client *c = mt9v111->client;
> - unsigned int ret;
> u16 outfmtctrl2;
> + int ret;
>
> /* Force device reset. */
> ret = __mt9v111_hw_reset(mt9v111);
> --
> 2.34.1
>
Powered by blists - more mailing lists