[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260129133340.302446-1-andriy.shevchenko@linux.intel.com>
Date: Thu, 29 Jan 2026 14:33:40 +0100
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Peng Fan <peng.fan@....com>,
linux-arm-kernel@...ts.infradead.org,
linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Daniel Mack <daniel@...que.org>,
Haojian Zhuang <haojian.zhuang@...il.com>,
Robert Jarzmik <robert.jarzmik@...e.fr>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [PATCH v1 1/1] ASoC: pxa2xx-ac97: Use devm_gpiod_get_optional()
No need to open code the devm_gpiod_get_optional() wrapper.
Instead of checking for a certain error code, check for NULL.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
sound/arm/pxa2xx-ac97-lib.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c
index 1e114dbcf93c..47889f6003c1 100644
--- a/sound/arm/pxa2xx-ac97-lib.c
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -330,13 +330,12 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev)
if (dev->dev.of_node) {
/* Assert reset using GPIOD_OUT_HIGH, because reset is GPIO_ACTIVE_LOW */
- rst_gpio = devm_gpiod_get(&dev->dev, "reset", GPIOD_OUT_HIGH);
+ rst_gpio = devm_gpiod_get_optional(&dev->dev, "reset", GPIOD_OUT_HIGH);
ret = PTR_ERR(rst_gpio);
- if (ret == -ENOENT)
- reset_gpio = -1;
- else if (ret)
+ if (ret)
return ret;
- reset_gpio = desc_to_gpio(rst_gpio);
+
+ reset_gpio = rst_gpio ? desc_to_gpio(rst_gpio) : -1;
} else {
if (cpu_is_pxa27x())
reset_gpio = 113;
--
2.50.1
Powered by blists - more mailing lists