diff mbox series

imx334: 'ret' is uninitialized, should have been PTR_ERR()

Message ID 917ccfef-b93e-4d90-0b5a-4974145ab187@xs4all.nl (mailing list archive)
State New, archived
Headers show
Series imx334: 'ret' is uninitialized, should have been PTR_ERR() | expand

Commit Message

Hans Verkuil Feb. 8, 2021, 11:32 a.m. UTC
Fix this compiler warning:

drivers/media/i2c/imx334.c: In function 'imx334_parse_hw_config':
include/linux/dev_printk.h:112:2: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
  112 |  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
      |  ^~~~~~~~
drivers/media/i2c/imx334.c:783:6: note: 'ret' was declared here
  783 |  int ret;
      |      ^~~

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
 drivers/media/i2c/imx334.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Sakari Ailus Feb. 8, 2021, 12:08 p.m. UTC | #1
Hi Hans,

On Mon, Feb 08, 2021 at 12:32:29PM +0100, Hans Verkuil wrote:
> Fix this compiler warning:
> 
> drivers/media/i2c/imx334.c: In function 'imx334_parse_hw_config':
> include/linux/dev_printk.h:112:2: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
>   112 |  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
>       |  ^~~~~~~~
> drivers/media/i2c/imx334.c:783:6: note: 'ret' was declared here
>   783 |  int ret;
>       |      ^~~
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
>  drivers/media/i2c/imx334.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c
> index 07e31bc2ef18..ad530f0d338a 100644
> --- a/drivers/media/i2c/imx334.c
> +++ b/drivers/media/i2c/imx334.c
> @@ -790,7 +790,8 @@ static int imx334_parse_hw_config(struct imx334 *imx334)
>  	imx334->reset_gpio = devm_gpiod_get_optional(imx334->dev, "reset",
>  						     GPIOD_OUT_LOW);
>  	if (IS_ERR(imx334->reset_gpio)) {
> -		dev_err(imx334->dev, "failed to get reset gpio %d", ret);
> +		dev_err(imx334->dev, "failed to get reset gpio %ld",
> +			PTR_ERR(imx334->reset_gpio));
>  		return PTR_ERR(imx334->reset_gpio);
>  	}
> 

Thanks for the patch.

Feel free to merge this through your tree if you think you'll have other
fixes. In that case,

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

I can also pick it if you like.
Hans Verkuil Feb. 8, 2021, 12:13 p.m. UTC | #2
On 08/02/2021 13:08, Sakari Ailus wrote:
> Hi Hans,
> 
> On Mon, Feb 08, 2021 at 12:32:29PM +0100, Hans Verkuil wrote:
>> Fix this compiler warning:
>>
>> drivers/media/i2c/imx334.c: In function 'imx334_parse_hw_config':
>> include/linux/dev_printk.h:112:2: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
>>   112 |  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
>>       |  ^~~~~~~~
>> drivers/media/i2c/imx334.c:783:6: note: 'ret' was declared here
>>   783 |  int ret;
>>       |      ^~~
>>
>> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
>> ---
>>  drivers/media/i2c/imx334.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c
>> index 07e31bc2ef18..ad530f0d338a 100644
>> --- a/drivers/media/i2c/imx334.c
>> +++ b/drivers/media/i2c/imx334.c
>> @@ -790,7 +790,8 @@ static int imx334_parse_hw_config(struct imx334 *imx334)
>>  	imx334->reset_gpio = devm_gpiod_get_optional(imx334->dev, "reset",
>>  						     GPIOD_OUT_LOW);
>>  	if (IS_ERR(imx334->reset_gpio)) {
>> -		dev_err(imx334->dev, "failed to get reset gpio %d", ret);
>> +		dev_err(imx334->dev, "failed to get reset gpio %ld",
>> +			PTR_ERR(imx334->reset_gpio));
>>  		return PTR_ERR(imx334->reset_gpio);
>>  	}
>>
> 
> Thanks for the patch.
> 
> Feel free to merge this through your tree if you think you'll have other
> fixes. In that case,
> 
> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> 
> I can also pick it if you like.
> 

Can you pick it up? I have no new PRs planned this week.

Regards,

	Hans
Sakari Ailus Feb. 8, 2021, 12:14 p.m. UTC | #3
On Mon, Feb 08, 2021 at 01:13:19PM +0100, Hans Verkuil wrote:
> On 08/02/2021 13:08, Sakari Ailus wrote:
> > Hi Hans,
> > 
> > On Mon, Feb 08, 2021 at 12:32:29PM +0100, Hans Verkuil wrote:
> >> Fix this compiler warning:
> >>
> >> drivers/media/i2c/imx334.c: In function 'imx334_parse_hw_config':
> >> include/linux/dev_printk.h:112:2: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
> >>   112 |  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
> >>       |  ^~~~~~~~
> >> drivers/media/i2c/imx334.c:783:6: note: 'ret' was declared here
> >>   783 |  int ret;
> >>       |      ^~~
> >>
> >> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> >> ---
> >>  drivers/media/i2c/imx334.c | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c
> >> index 07e31bc2ef18..ad530f0d338a 100644
> >> --- a/drivers/media/i2c/imx334.c
> >> +++ b/drivers/media/i2c/imx334.c
> >> @@ -790,7 +790,8 @@ static int imx334_parse_hw_config(struct imx334 *imx334)
> >>  	imx334->reset_gpio = devm_gpiod_get_optional(imx334->dev, "reset",
> >>  						     GPIOD_OUT_LOW);
> >>  	if (IS_ERR(imx334->reset_gpio)) {
> >> -		dev_err(imx334->dev, "failed to get reset gpio %d", ret);
> >> +		dev_err(imx334->dev, "failed to get reset gpio %ld",
> >> +			PTR_ERR(imx334->reset_gpio));
> >>  		return PTR_ERR(imx334->reset_gpio);
> >>  	}
> >>
> > 
> > Thanks for the patch.
> > 
> > Feel free to merge this through your tree if you think you'll have other
> > fixes. In that case,
> > 
> > Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > 
> > I can also pick it if you like.
> > 
> 
> Can you pick it up? I have no new PRs planned this week.

Sure!
diff mbox series

Patch

diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c
index 07e31bc2ef18..ad530f0d338a 100644
--- a/drivers/media/i2c/imx334.c
+++ b/drivers/media/i2c/imx334.c
@@ -790,7 +790,8 @@  static int imx334_parse_hw_config(struct imx334 *imx334)
 	imx334->reset_gpio = devm_gpiod_get_optional(imx334->dev, "reset",
 						     GPIOD_OUT_LOW);
 	if (IS_ERR(imx334->reset_gpio)) {
-		dev_err(imx334->dev, "failed to get reset gpio %d", ret);
+		dev_err(imx334->dev, "failed to get reset gpio %ld",
+			PTR_ERR(imx334->reset_gpio));
 		return PTR_ERR(imx334->reset_gpio);
 	}