Linux IIO development
 help / color / mirror / Atom feed
* [PATCH next] iio: chemical: mhz19b: Fix error code in probe()
@ 2025-05-07 12:59 Dan Carpenter
  2025-05-07 13:34 ` David Lechner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-05-07 12:59 UTC (permalink / raw)
  To: Gyeyoung Baek
  Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	linux-iio, linux-kernel, kernel-janitors

Return -ENOMEM if devm_iio_device_alloc() fails.  Don't return success.

Fixes: b43278d66e99 ("iio: chemical: Add support for Winsen MHZ19B CO2 sensor")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/iio/chemical/mhz19b.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/chemical/mhz19b.c b/drivers/iio/chemical/mhz19b.c
index c0052ba3ac6c..3c64154918b1 100644
--- a/drivers/iio/chemical/mhz19b.c
+++ b/drivers/iio/chemical/mhz19b.c
@@ -276,7 +276,7 @@ static int mhz19b_probe(struct serdev_device *serdev)
 
 	indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
 	if (!indio_dev)
-		return ret;
+		return -ENOMEM;
 	serdev_device_set_drvdata(serdev, indio_dev);
 
 	st = iio_priv(indio_dev);
-- 
2.47.2


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

* Re: [PATCH next] iio: chemical: mhz19b: Fix error code in probe()
  2025-05-07 12:59 [PATCH next] iio: chemical: mhz19b: Fix error code in probe() Dan Carpenter
@ 2025-05-07 13:34 ` David Lechner
  2025-05-07 15:55 ` Gyeyoung Baek
  2025-05-08 19:08 ` Jonathan Cameron
  2 siblings, 0 replies; 4+ messages in thread
From: David Lechner @ 2025-05-07 13:34 UTC (permalink / raw)
  To: Dan Carpenter, Gyeyoung Baek
  Cc: Jonathan Cameron, Nuno Sá, Andy Shevchenko, linux-iio,
	linux-kernel, kernel-janitors

On 5/7/25 7:59 AM, Dan Carpenter wrote:
> Return -ENOMEM if devm_iio_device_alloc() fails.  Don't return success.
> 
> Fixes: b43278d66e99 ("iio: chemical: Add support for Winsen MHZ19B CO2 sensor")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---

Reviewed-by: David Lechner <dlechner@baylibre.com>


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

* Re: [PATCH next] iio: chemical: mhz19b: Fix error code in probe()
  2025-05-07 12:59 [PATCH next] iio: chemical: mhz19b: Fix error code in probe() Dan Carpenter
  2025-05-07 13:34 ` David Lechner
@ 2025-05-07 15:55 ` Gyeyoung Baek
  2025-05-08 19:08 ` Jonathan Cameron
  2 siblings, 0 replies; 4+ messages in thread
From: Gyeyoung Baek @ 2025-05-07 15:55 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	linux-iio, linux-kernel, kernel-janitors

On Wed, May 7, 2025 at 9:59 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> Return -ENOMEM if devm_iio_device_alloc() fails.  Don't return success.

I missed that devm_iio_device_alloc() can return NULL on failure.
Thanks for the patch!

Acked-by: Gyeyoung Baek <gye976@gmail.com>

--
Regards,
Gyeyoung

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

* Re: [PATCH next] iio: chemical: mhz19b: Fix error code in probe()
  2025-05-07 12:59 [PATCH next] iio: chemical: mhz19b: Fix error code in probe() Dan Carpenter
  2025-05-07 13:34 ` David Lechner
  2025-05-07 15:55 ` Gyeyoung Baek
@ 2025-05-08 19:08 ` Jonathan Cameron
  2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2025-05-08 19:08 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Gyeyoung Baek, David Lechner, Nuno Sá, Andy Shevchenko,
	linux-iio, linux-kernel, kernel-janitors

On Wed, 7 May 2025 15:59:00 +0300
Dan Carpenter <dan.carpenter@linaro.org> wrote:

> Return -ENOMEM if devm_iio_device_alloc() fails.  Don't return success.
> 
> Fixes: b43278d66e99 ("iio: chemical: Add support for Winsen MHZ19B CO2 sensor")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Applied.

Tah
> ---
>  drivers/iio/chemical/mhz19b.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/chemical/mhz19b.c b/drivers/iio/chemical/mhz19b.c
> index c0052ba3ac6c..3c64154918b1 100644
> --- a/drivers/iio/chemical/mhz19b.c
> +++ b/drivers/iio/chemical/mhz19b.c
> @@ -276,7 +276,7 @@ static int mhz19b_probe(struct serdev_device *serdev)
>  
>  	indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
>  	if (!indio_dev)
> -		return ret;
> +		return -ENOMEM;
>  	serdev_device_set_drvdata(serdev, indio_dev);
>  
>  	st = iio_priv(indio_dev);


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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-07 12:59 [PATCH next] iio: chemical: mhz19b: Fix error code in probe() Dan Carpenter
2025-05-07 13:34 ` David Lechner
2025-05-07 15:55 ` Gyeyoung Baek
2025-05-08 19:08 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox