kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: temperature: mlx90635: Fix ERR_PTR dereference in mlx90635_probe()
@ 2024-05-13 18:45 Harshit Mogalapalli
  2024-05-13 20:02 ` Crt Mori
  0 siblings, 1 reply; 4+ messages in thread
From: Harshit Mogalapalli @ 2024-05-13 18:45 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, ragmap_ee could be error pointer,
instead of checking for IS_ERR(ragmap_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.
---
 drivers/iio/temperature/mlx90635.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/temperature/mlx90635.c b/drivers/iio/temperature/mlx90635.c
index 1f5c962c1818..2b61489d5ee0 100644
--- a/drivers/iio/temperature/mlx90635.c
+++ b/drivers/iio/temperature/mlx90635.c
@@ -947,8 +947,8 @@ 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),
+	if (IS_ERR(regmap_ee))
+		return dev_err_probe(&client->dev, PTR_ERR(regmap_ee),
 				     "failed to allocate regmap\n");
 
 	mlx90635 = iio_priv(indio_dev);
-- 
2.39.3


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

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

Hi,
I agree it is is copy-paste error. Minor remark below and a few typo
fixes in commit message. Thanks for your contribution.

Reviewed-by: Crt Mori<cmo@melexis.com>

On Mon, 13 May 2024 at 20:47, Harshit Mogalapalli
<harshit.m.mogalapalli@oracle.com> wrote:
>
> When devm_regmap_init_i2c() fails, ragmap_ee could be error pointer,
When devm_regmap_init_i2c() fails, regmap_ee could be error pointer,

> instead of checking for IS_ERR(ragmap_ee), regmap is checked which looks
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.
> ---
>  drivers/iio/temperature/mlx90635.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/temperature/mlx90635.c b/drivers/iio/temperature/mlx90635.c
> index 1f5c962c1818..2b61489d5ee0 100644
> --- a/drivers/iio/temperature/mlx90635.c
> +++ b/drivers/iio/temperature/mlx90635.c
> @@ -947,8 +947,8 @@ 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),
> +       if (IS_ERR(regmap_ee))
> +               return dev_err_probe(&client->dev, PTR_ERR(regmap_ee),
>                                      "failed to allocate regmap\n");

Maybe fix her would also be to this regmap error message to include
regmap EEPROM?

>
>         mlx90635 = iio_priv(indio_dev);
> --
> 2.39.3
>

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

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

Hi Crt,

On 14/05/24 01:32, Crt Mori wrote:
> Hi,
> I agree it is is copy-paste error. Minor remark below and a few typo
> fixes in commit message. Thanks for your contribution.
> 
> Reviewed-by: Crt Mori<cmo@melexis.com>
> 

Thanks for the review.


> On Mon, 13 May 2024 at 20:47, Harshit Mogalapalli
> <harshit.m.mogalapalli@oracle.com> wrote:
>>
>> When devm_regmap_init_i2c() fails, ragmap_ee could be error pointer,
> When devm_regmap_init_i2c() fails, regmap_ee could be error pointer,
> 

Oops, sorry for the typo, I will fix it in V2.

>> instead of checking for IS_ERR(ragmap_ee), regmap is checked which looks
> 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.
>> ---
>>   drivers/iio/temperature/mlx90635.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/iio/temperature/mlx90635.c b/drivers/iio/temperature/mlx90635.c
>> index 1f5c962c1818..2b61489d5ee0 100644
>> --- a/drivers/iio/temperature/mlx90635.c
>> +++ b/drivers/iio/temperature/mlx90635.c
>> @@ -947,8 +947,8 @@ 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),
>> +       if (IS_ERR(regmap_ee))
>> +               return dev_err_probe(&client->dev, PTR_ERR(regmap_ee),
>>                                       "failed to allocate regmap\n");
> 
> Maybe fix her would also be to this regmap error message to include
> regmap EEPROM?
> 
Should we make it like:

"failed to allocate EEPROM regmap\n" ?

Thanks,
Harshit


>>
>>          mlx90635 = iio_priv(indio_dev);
>> --
>> 2.39.3
>>


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

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

On Mon, 13 May 2024 at 22:24, Harshit Mogalapalli
<harshit.m.mogalapalli@oracle.com> wrote:
>
> Hi Crt,
>
> On 14/05/24 01:32, Crt Mori wrote:
> > Hi,
> > I agree it is is copy-paste error. Minor remark below and a few typo
> > fixes in commit message. Thanks for your contribution.
> >
> > Reviewed-by: Crt Mori<cmo@melexis.com>
> >
>
> Thanks for the review.
>
>
> > On Mon, 13 May 2024 at 20:47, Harshit Mogalapalli
> > <harshit.m.mogalapalli@oracle.com> wrote:
> >>
> >> When devm_regmap_init_i2c() fails, ragmap_ee could be error pointer,
> > When devm_regmap_init_i2c() fails, regmap_ee could be error pointer,
> >
>
> Oops, sorry for the typo, I will fix it in V2.
>
> >> instead of checking for IS_ERR(ragmap_ee), regmap is checked which looks
> > instead of checking for IS_ERR(regmap_ee), regmap is checked which looks

There is another typo here in case you missed it.

> >> 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.
> >> ---
> >>   drivers/iio/temperature/mlx90635.c | 4 ++--
> >>   1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/iio/temperature/mlx90635.c b/drivers/iio/temperature/mlx90635.c
> >> index 1f5c962c1818..2b61489d5ee0 100644
> >> --- a/drivers/iio/temperature/mlx90635.c
> >> +++ b/drivers/iio/temperature/mlx90635.c
> >> @@ -947,8 +947,8 @@ 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),
> >> +       if (IS_ERR(regmap_ee))
> >> +               return dev_err_probe(&client->dev, PTR_ERR(regmap_ee),
> >>                                       "failed to allocate regmap\n");
> >
> > Maybe fix her would also be to this regmap error message to include
> > regmap EEPROM?
> >
> Should we make it like:
>
> "failed to allocate EEPROM regmap\n" ?
>

Sure, we can change it to that. Descriptive enough.

> Thanks,
> Harshit
>
>
> >>
> >>          mlx90635 = iio_priv(indio_dev);
> >> --
> >> 2.39.3
> >>
>

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

end of thread, other threads:[~2024-05-13 20:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-13 18:45 [PATCH] iio: temperature: mlx90635: Fix ERR_PTR dereference in mlx90635_probe() Harshit Mogalapalli
2024-05-13 20:02 ` Crt Mori
2024-05-13 20:12   ` Harshit Mogalapalli
2024-05-13 20:26     ` Crt Mori

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).