kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH  v2] iio: temperature: mlx90635: Fix ERR_PTR dereference in mlx90635_probe()
@ 2024-05-13 20:34 Harshit Mogalapalli
  2024-05-19 12:29 ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Harshit Mogalapalli @ 2024-05-13 20:34 UTC (permalink / raw)
  To: Crt Mori, Jonathan Cameron, Lars-Peter Clausen, linux-iio, linux-kernel
  Cc: dan.carpenter, kernel-janitors, error27, harshit.m.mogalapalli

When devm_regmap_init_i2c() fails, regmap_ee could be error pointer,
instead of checking for IS_ERR(regmap_ee), regmap is checked which looks
like a copy paste error.

Fixes: a1d1ba5e1c28 ("iio: temperature: mlx90635 MLX90635 IR Temperature sensor")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is found using smatch, only compile tested.
v1->v2: Address Crt's comments.
---
 drivers/iio/temperature/mlx90635.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/temperature/mlx90635.c b/drivers/iio/temperature/mlx90635.c
index 1f5c962c1818..f7f88498ba0e 100644
--- a/drivers/iio/temperature/mlx90635.c
+++ b/drivers/iio/temperature/mlx90635.c
@@ -947,9 +947,9 @@ static int mlx90635_probe(struct i2c_client *client)
 				     "failed to allocate regmap\n");
 
 	regmap_ee = devm_regmap_init_i2c(client, &mlx90635_regmap_ee);
-	if (IS_ERR(regmap))
-		return dev_err_probe(&client->dev, PTR_ERR(regmap),
-				     "failed to allocate regmap\n");
+	if (IS_ERR(regmap_ee))
+		return dev_err_probe(&client->dev, PTR_ERR(regmap_ee),
+				     "failed to allocate EEPROM regmap\n");
 
 	mlx90635 = iio_priv(indio_dev);
 	i2c_set_clientdata(client, indio_dev);
-- 
2.39.3


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

* Re: [PATCH  v2] iio: temperature: mlx90635: Fix ERR_PTR dereference in mlx90635_probe()
  2024-05-13 20:34 [PATCH v2] iio: temperature: mlx90635: Fix ERR_PTR dereference in mlx90635_probe() Harshit Mogalapalli
@ 2024-05-19 12:29 ` Jonathan Cameron
  2024-05-19 13:36   ` Harshit Mogalapalli
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2024-05-19 12:29 UTC (permalink / raw)
  To: Harshit Mogalapalli
  Cc: Crt Mori, Lars-Peter Clausen, linux-iio, linux-kernel,
	dan.carpenter, kernel-janitors, error27

On Mon, 13 May 2024 13:34:27 -0700
Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> wrote:

> When devm_regmap_init_i2c() fails, regmap_ee could be error pointer,
> instead of checking for IS_ERR(regmap_ee), regmap is checked which looks
> like a copy paste error.
> 
> Fixes: a1d1ba5e1c28 ("iio: temperature: mlx90635 MLX90635 IR Temperature sensor")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Please make sure to pick up tags given on earlier versions.  You dropped
Crt's Reviewed-by without giving a reasons. I've put it back.

Applied to the fixes-togreg branch of iio.git and marked for stable.
I'll be rebasing that on rc1 once available. Until then it won't be visible.

Thanks,

Jonathan

> ---
> This is found using smatch, only compile tested.
> v1->v2: Address Crt's comments.
> ---
>  drivers/iio/temperature/mlx90635.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/temperature/mlx90635.c b/drivers/iio/temperature/mlx90635.c
> index 1f5c962c1818..f7f88498ba0e 100644
> --- a/drivers/iio/temperature/mlx90635.c
> +++ b/drivers/iio/temperature/mlx90635.c
> @@ -947,9 +947,9 @@ static int mlx90635_probe(struct i2c_client *client)
>  				     "failed to allocate regmap\n");
>  
>  	regmap_ee = devm_regmap_init_i2c(client, &mlx90635_regmap_ee);
> -	if (IS_ERR(regmap))
> -		return dev_err_probe(&client->dev, PTR_ERR(regmap),
> -				     "failed to allocate regmap\n");
> +	if (IS_ERR(regmap_ee))
> +		return dev_err_probe(&client->dev, PTR_ERR(regmap_ee),
> +				     "failed to allocate EEPROM regmap\n");
>  
>  	mlx90635 = iio_priv(indio_dev);
>  	i2c_set_clientdata(client, indio_dev);


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

* Re: [PATCH v2] iio: temperature: mlx90635: Fix ERR_PTR dereference in mlx90635_probe()
  2024-05-19 12:29 ` Jonathan Cameron
@ 2024-05-19 13:36   ` Harshit Mogalapalli
  2024-05-19 19:00     ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Harshit Mogalapalli @ 2024-05-19 13:36 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Crt Mori, Lars-Peter Clausen, linux-iio, linux-kernel,
	dan.carpenter, kernel-janitors, error27

Hi Jonathan,

On 19/05/24 17:59, Jonathan Cameron wrote:
> On Mon, 13 May 2024 13:34:27 -0700
> Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> wrote:
> 
>> When devm_regmap_init_i2c() fails, regmap_ee could be error pointer,
>> instead of checking for IS_ERR(regmap_ee), regmap is checked which looks
>> like a copy paste error.
>>
>> Fixes: a1d1ba5e1c28 ("iio: temperature: mlx90635 MLX90635 IR Temperature sensor")
>> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> Please make sure to pick up tags given on earlier versions.  You dropped
> Crt's Reviewed-by without giving a reasons. I've put it back.
> 

Sorry, I thought we should not add tags as v1-->v2: is for addressing 
the reviewers(Crt's) comments.

I will keep this in mind.

Thanks,
Harshit

> Applied to the fixes-togreg branch of iio.git and marked for stable.
> I'll be rebasing that on rc1 once available. Until then it won't be visible.
> 
> Thanks,
> 
> Jonathan
> 
>> ---
>> This is found using smatch, only compile tested.
>> v1->v2: Address Crt's comments.
>> ---
>>   drivers/iio/temperature/mlx90635.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/iio/temperature/mlx90635.c b/drivers/iio/temperature/mlx90635.c
>> index 1f5c962c1818..f7f88498ba0e 100644
>> --- a/drivers/iio/temperature/mlx90635.c
>> +++ b/drivers/iio/temperature/mlx90635.c
>> @@ -947,9 +947,9 @@ static int mlx90635_probe(struct i2c_client *client)
>>   				     "failed to allocate regmap\n");
>>   
>>   	regmap_ee = devm_regmap_init_i2c(client, &mlx90635_regmap_ee);
>> -	if (IS_ERR(regmap))
>> -		return dev_err_probe(&client->dev, PTR_ERR(regmap),
>> -				     "failed to allocate regmap\n");
>> +	if (IS_ERR(regmap_ee))
>> +		return dev_err_probe(&client->dev, PTR_ERR(regmap_ee),
>> +				     "failed to allocate EEPROM regmap\n");
>>   
>>   	mlx90635 = iio_priv(indio_dev);
>>   	i2c_set_clientdata(client, indio_dev);
> 


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

* Re: [PATCH v2] iio: temperature: mlx90635: Fix ERR_PTR dereference in mlx90635_probe()
  2024-05-19 13:36   ` Harshit Mogalapalli
@ 2024-05-19 19:00     ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2024-05-19 19:00 UTC (permalink / raw)
  To: Harshit Mogalapalli
  Cc: Crt Mori, Lars-Peter Clausen, linux-iio, linux-kernel,
	dan.carpenter, kernel-janitors, error27

On Sun, 19 May 2024 19:06:55 +0530
Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> wrote:

> Hi Jonathan,
> 
> On 19/05/24 17:59, Jonathan Cameron wrote:
> > On Mon, 13 May 2024 13:34:27 -0700
> > Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> wrote:
> >   
> >> When devm_regmap_init_i2c() fails, regmap_ee could be error pointer,
> >> instead of checking for IS_ERR(regmap_ee), regmap is checked which looks
> >> like a copy paste error.
> >>
> >> Fixes: a1d1ba5e1c28 ("iio: temperature: mlx90635 MLX90635 IR Temperature sensor")
> >> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>  
> > Please make sure to pick up tags given on earlier versions.  You dropped
> > Crt's Reviewed-by without giving a reasons. I've put it back.
> >   
> 
> Sorry, I thought we should not add tags as v1-->v2: is for addressing 
> the reviewers(Crt's) comments.
> 
> I will keep this in mind.
It's a case of judging if they are likely to mind the changes.
Here Crt had confirmed he was, so easy decision!

If you drop a tag, just say why below the --- in the patch.



> 
> Thanks,
> Harshit
> 
> > Applied to the fixes-togreg branch of iio.git and marked for stable.
> > I'll be rebasing that on rc1 once available. Until then it won't be visible.
> > 
> > Thanks,
> > 
> > Jonathan
> >   
> >> ---
> >> This is found using smatch, only compile tested.
> >> v1->v2: Address Crt's comments.
> >> ---
> >>   drivers/iio/temperature/mlx90635.c | 6 +++---
> >>   1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/iio/temperature/mlx90635.c b/drivers/iio/temperature/mlx90635.c
> >> index 1f5c962c1818..f7f88498ba0e 100644
> >> --- a/drivers/iio/temperature/mlx90635.c
> >> +++ b/drivers/iio/temperature/mlx90635.c
> >> @@ -947,9 +947,9 @@ static int mlx90635_probe(struct i2c_client *client)
> >>   				     "failed to allocate regmap\n");
> >>   
> >>   	regmap_ee = devm_regmap_init_i2c(client, &mlx90635_regmap_ee);
> >> -	if (IS_ERR(regmap))
> >> -		return dev_err_probe(&client->dev, PTR_ERR(regmap),
> >> -				     "failed to allocate regmap\n");
> >> +	if (IS_ERR(regmap_ee))
> >> +		return dev_err_probe(&client->dev, PTR_ERR(regmap_ee),
> >> +				     "failed to allocate EEPROM regmap\n");
> >>   
> >>   	mlx90635 = iio_priv(indio_dev);
> >>   	i2c_set_clientdata(client, indio_dev);  
> >   
> 


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

end of thread, other threads:[~2024-05-19 19:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-13 20:34 [PATCH v2] iio: temperature: mlx90635: Fix ERR_PTR dereference in mlx90635_probe() Harshit Mogalapalli
2024-05-19 12:29 ` Jonathan Cameron
2024-05-19 13:36   ` Harshit Mogalapalli
2024-05-19 19:00     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).