diff mbox series

[05/16] iio: adc: max1027: Drop extra warning message

Message ID 20210818111139.330636-6-miquel.raynal@bootlin.com (mailing list archive)
State Changes Requested
Headers show
Series Bring software triggers support to MAX1027-like ADCs | expand

Commit Message

Miquel Raynal Aug. 18, 2021, 11:11 a.m. UTC
Memory allocation errors automatically trigger the right logs, no need
to have our own.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/iio/adc/max1027.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Nuno Sa Aug. 20, 2021, 7:12 a.m. UTC | #1
> -----Original Message-----
> From: Miquel Raynal <miquel.raynal@bootlin.com>
> Sent: Wednesday, August 18, 2021 1:11 PM
> To: Jonathan Cameron <jic23@kernel.org>; Lars-Peter Clausen
> <lars@metafoo.de>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>; linux-
> iio@vger.kernel.org; linux-kernel@vger.kernel.org; Miquel Raynal
> <miquel.raynal@bootlin.com>
> Subject: [PATCH 05/16] iio: adc: max1027: Drop extra warning message
> 
> [External]
> 
> Memory allocation errors automatically trigger the right logs, no need
> to have our own.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  drivers/iio/adc/max1027.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
> index d79dabf20567..ac603b4ca787 100644
> --- a/drivers/iio/adc/max1027.c
> +++ b/drivers/iio/adc/max1027.c
> @@ -461,10 +461,8 @@ static int max1027_probe(struct spi_device
> *spi)
>  	st->buffer = devm_kmalloc_array(&indio_dev->dev,
>  				  indio_dev->num_channels, 2,
>  				  GFP_KERNEL);
> -	if (st->buffer == NULL) {
> -		dev_err(&indio_dev->dev, "Can't allocate buffer\n");
> +	if (!st->buffer)
>  		return -ENOMEM;
> -	}
> 
>  	if (spi->irq) {
>  		ret = devm_iio_triggered_buffer_setup(&spi->dev,
> indio_dev,
> --
> 2.27.0

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Jonathan Cameron Aug. 30, 2021, 10:12 a.m. UTC | #2
On Wed, 18 Aug 2021 13:11:28 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Memory allocation errors automatically trigger the right logs, no need
> to have our own.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  drivers/iio/adc/max1027.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
> index d79dabf20567..ac603b4ca787 100644
> --- a/drivers/iio/adc/max1027.c
> +++ b/drivers/iio/adc/max1027.c
> @@ -461,10 +461,8 @@ static int max1027_probe(struct spi_device *spi)
>  	st->buffer = devm_kmalloc_array(&indio_dev->dev,
>  				  indio_dev->num_channels, 2,
>  				  GFP_KERNEL);
> -	if (st->buffer == NULL) {
> -		dev_err(&indio_dev->dev, "Can't allocate buffer\n");
> +	if (!st->buffer)
Don't change the form of the check.  Whilst it doesn't matter in general
which of these is used (and I actually prefer the one you end up with) this
change makes this case inconsistent with the style elsewhere in the driver.

If you want to clean these all up then I don't mind that, but please do
the lot in one patch doing just that.

Thanks,

Jonathan

>  		return -ENOMEM;
> -	}
>  
>  	if (spi->irq) {
>  		ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev,
diff mbox series

Patch

diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
index d79dabf20567..ac603b4ca787 100644
--- a/drivers/iio/adc/max1027.c
+++ b/drivers/iio/adc/max1027.c
@@ -461,10 +461,8 @@  static int max1027_probe(struct spi_device *spi)
 	st->buffer = devm_kmalloc_array(&indio_dev->dev,
 				  indio_dev->num_channels, 2,
 				  GFP_KERNEL);
-	if (st->buffer == NULL) {
-		dev_err(&indio_dev->dev, "Can't allocate buffer\n");
+	if (!st->buffer)
 		return -ENOMEM;
-	}
 
 	if (spi->irq) {
 		ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev,