[PATCH 1/2] iio: adc: ad7266: simplify error return

Antoniu Miclaus posted 2 patches 1 month, 1 week ago
[PATCH 1/2] iio: adc: ad7266: simplify error return
Posted by Antoniu Miclaus 1 month, 1 week ago
Return PTR_ERR() directly instead of assigning it to an intermediate
variable first.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
 drivers/iio/adc/ad7266.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c
index 3364ac6c4631..0ef36c249ab8 100644
--- a/drivers/iio/adc/ad7266.c
+++ b/drivers/iio/adc/ad7266.c
@@ -409,10 +409,8 @@ static int ad7266_probe(struct spi_device *spi)
 				st->gpios[i] = devm_gpiod_get(&spi->dev,
 						      ad7266_gpio_labels[i],
 						      GPIOD_OUT_LOW);
-				if (IS_ERR(st->gpios[i])) {
-					ret = PTR_ERR(st->gpios[i]);
-					return ret;
-				}
+				if (IS_ERR(st->gpios[i]))
+					return PTR_ERR(st->gpios[i]);
 			}
 		}
 	} else {
-- 
2.43.0
Re: [PATCH 1/2] iio: adc: ad7266: simplify error return
Posted by Andy Shevchenko 1 month, 1 week ago
On Fri, Feb 20, 2026 at 03:18:46PM +0200, Antoniu Miclaus wrote:
> Return PTR_ERR() directly instead of assigning it to an intermediate
> variable first.

Definitely!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH 1/2] iio: adc: ad7266: simplify error return
Posted by Jonathan Cameron 1 month, 1 week ago
On Fri, 20 Feb 2026 16:09:08 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Fri, Feb 20, 2026 at 03:18:46PM +0200, Antoniu Miclaus wrote:
> > Return PTR_ERR() directly instead of assigning it to an intermediate
> > variable first.  
> 
> Definitely!
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Applied.
>