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

Xichao Zhao posted 7 patches 1 month, 1 week ago
[PATCH 3/7] iio: chemical: 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/chemical/ens160_core.c | 3 +--
 drivers/iio/chemical/scd30_core.c  | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/chemical/ens160_core.c b/drivers/iio/chemical/ens160_core.c
index 6cec60074827..86bde4a91bf7 100644
--- a/drivers/iio/chemical/ens160_core.c
+++ b/drivers/iio/chemical/ens160_core.c
@@ -305,8 +305,7 @@ static int ens160_setup_trigger(struct iio_dev *indio_dev, int irq)
 	trig = devm_iio_trigger_alloc(dev, "%s-dev%d", indio_dev->name,
 				      iio_device_id(indio_dev));
 	if (!trig)
-		return dev_err_probe(dev, -ENOMEM,
-				     "failed to allocate trigger\n");
+		return -ENOMEM;
 
 	trig->ops = &ens160_trigger_ops;
 	iio_trigger_set_drvdata(trig, indio_dev);
diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c
index 5df1926cd5d9..a665fcb78806 100644
--- a/drivers/iio/chemical/scd30_core.c
+++ b/drivers/iio/chemical/scd30_core.c
@@ -635,7 +635,7 @@ static int scd30_setup_trigger(struct iio_dev *indio_dev)
 	trig = devm_iio_trigger_alloc(dev, "%s-dev%d", indio_dev->name,
 				      iio_device_id(indio_dev));
 	if (!trig)
-		return dev_err_probe(dev, -ENOMEM, "failed to allocate trigger\n");
+		return -ENOMEM;
 
 	trig->ops = &scd30_trigger_ops;
 	iio_trigger_set_drvdata(trig, indio_dev);
-- 
2.34.1
Re: [PATCH 3/7] iio: chemical: Remove dev_err_probe() if error is -ENOMEM
Posted by Gustavo Silva 1 month, 1 week ago
On Thu, Aug 21, 2025 at 04:06:47PM +0800, Xichao Zhao 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/chemical/ens160_core.c | 3 +--
>  drivers/iio/chemical/scd30_core.c  | 2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
For ens160:
Reviewed-by: Gustavo Silva <gustavograzs@gmail.com>
Re: [PATCH 3/7] iio: chemical: Remove dev_err_probe() if error is -ENOMEM
Posted by Jonathan Cameron 1 month, 1 week ago
On Sat, 23 Aug 2025 14:27:55 -0300
Gustavo Silva <gustavograzs@gmail.com> wrote:

> On Thu, Aug 21, 2025 at 04:06:47PM +0800, Xichao Zhao 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/chemical/ens160_core.c | 3 +--
> >  drivers/iio/chemical/scd30_core.c  | 2 +-
> >  2 files changed, 2 insertions(+), 3 deletions(-)  
> For ens160:
> Reviewed-by: Gustavo Silva <gustavograzs@gmail.com>

Please use
Reviewed-by: Gustavo Silva <gustavograzs@gmail.com> # for ens160

for commented tags.  Then tooling should pick them up correctly
without me needing to hand edit.

Thanks,

Jonathan