[PATCH 7/7] iio: temperature: mlx90635: Remove dev_err_probe() if error is -ENOMEM

Xichao Zhao posted 7 patches 1 month, 1 week ago
[PATCH 7/7] iio: temperature: mlx90635: Remove dev_err_probe() if error is -ENOMEM
Posted by Xichao Zhao 1 month, 1 week ago
The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
Therefore, remove the useless call to dev_err_probe(), and just
return the value instead.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 drivers/iio/temperature/mlx90635.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/temperature/mlx90635.c b/drivers/iio/temperature/mlx90635.c
index f7f88498ba0e..6d386d887855 100644
--- a/drivers/iio/temperature/mlx90635.c
+++ b/drivers/iio/temperature/mlx90635.c
@@ -939,7 +939,7 @@ static int mlx90635_probe(struct i2c_client *client)
 
 	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*mlx90635));
 	if (!indio_dev)
-		return dev_err_probe(&client->dev, -ENOMEM, "failed to allocate device\n");
+		return -ENOMEM;
 
 	regmap = devm_regmap_init_i2c(client, &mlx90635_regmap);
 	if (IS_ERR(regmap))
-- 
2.34.1
Re: [PATCH 7/7] iio: temperature: mlx90635: Remove dev_err_probe() if error is -ENOMEM
Posted by Crt Mori 1 month, 1 week ago
I am not sure I agree with this. It provides an error message with
reason and I understand we want as few as possible, but this would be
a valid remark inside the logs?

On Thu, 21 Aug 2025 at 10:08, Xichao Zhao <zhao.xichao@vivo.com> wrote:
>
> The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
> Therefore, remove the useless call to dev_err_probe(), and just
> return the value instead.
>
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
>  drivers/iio/temperature/mlx90635.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/temperature/mlx90635.c b/drivers/iio/temperature/mlx90635.c
> index f7f88498ba0e..6d386d887855 100644
> --- a/drivers/iio/temperature/mlx90635.c
> +++ b/drivers/iio/temperature/mlx90635.c
> @@ -939,7 +939,7 @@ static int mlx90635_probe(struct i2c_client *client)
>
>         indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*mlx90635));
>         if (!indio_dev)
> -               return dev_err_probe(&client->dev, -ENOMEM, "failed to allocate device\n");
> +               return -ENOMEM;
>
>         regmap = devm_regmap_init_i2c(client, &mlx90635_regmap);
>         if (IS_ERR(regmap))
> --
> 2.34.1
>
Re: [PATCH 7/7] iio: temperature: mlx90635: Remove dev_err_probe() if error is -ENOMEM
Posted by Andy Shevchenko 1 month, 1 week ago
On Thu, Aug 21, 2025 at 2:47 PM Crt Mori <cmo@melexis.com> wrote:
>
> I am not sure I agree with this. It provides an error message with
> reason and I understand we want as few as possible, but this would be
> a valid remark inside the logs?

How? dev_err_probe() is no-op for ENOMEM.

Also there is an agreement inside the kernel community that ENOMEM
errors need no log, as if it's the case, we have much bigger issues
than that.

> On Thu, 21 Aug 2025 at 10:08, Xichao Zhao <zhao.xichao@vivo.com> wrote:
> >
> > The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
> > Therefore, remove the useless call to dev_err_probe(), and just
> > return the value instead.

With all that said, the series is correct and good to go. I don't see
obstacles otherwise.

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH 7/7] iio: temperature: mlx90635: Remove dev_err_probe() if error is -ENOMEM
Posted by Crt Mori 1 month, 1 week ago
Ok, fair enough. (sorry was html message before)

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

On Thu, 21 Aug 2025 at 14:47, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
>
> On Thu, Aug 21, 2025 at 2:47 PM Crt Mori <cmo@melexis.com> wrote:
> >
> > I am not sure I agree with this. It provides an error message with
> > reason and I understand we want as few as possible, but this would be
> > a valid remark inside the logs?
>
> How? dev_err_probe() is no-op for ENOMEM.
>
> Also there is an agreement inside the kernel community that ENOMEM
> errors need no log, as if it's the case, we have much bigger issues
> than that.
>
> > On Thu, 21 Aug 2025 at 10:08, Xichao Zhao <zhao.xichao@vivo.com> wrote:
> > >
> > > The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
> > > Therefore, remove the useless call to dev_err_probe(), and just
> > > return the value instead.
>
> With all that said, the series is correct and good to go. I don't see
> obstacles otherwise.
>
> --
> With Best Regards,
> Andy Shevchenko