* [PATCH] ASoC: pxa2xx-ac97: fix error handling for reset GPIO descriptor
@ 2026-04-13 10:52 Peng Fan (OSS)
2026-04-13 17:02 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Peng Fan (OSS) @ 2026-04-13 10:52 UTC (permalink / raw)
To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Jaroslav Kysela,
Takashi Iwai, Mark Brown
Cc: linux-arm-kernel, linux-sound, linux-kernel, Peng Fan,
kernel test robot, Dan Carpenter
From: Peng Fan <peng.fan@nxp.com>
The reset GPIO obtained via devm_gpiod_get() may return an ERR_PTR()
when the GPIO is missing or an error occurs. The current code
unconditionally assigns PTR_ERR() to ret and later dereferences
rst_gpio via desc_to_gpio(), which is incorrect when rst_gpio is an
error pointer.
Rework the logic to first check IS_ERR(rst_gpio) before converting the
descriptor. Handle -ENOENT by disabling reset GPIO support, and return
other errors to the caller as expected.
Fixes: c76d50b71e89 ("ASoC: ac97: Convert to GPIO descriptors")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202604041426.i2C1xqHk-lkp@intel.com/
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
sound/arm/pxa2xx-ac97-lib.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c
index 1e114dbcf93c94ef30b7b81c40ef9aa30d1271ff..79eb557d4942f19df843d057bfcc0cddb28cf4d8 100644
--- a/sound/arm/pxa2xx-ac97-lib.c
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -331,12 +331,15 @@ 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);
- ret = PTR_ERR(rst_gpio);
- if (ret == -ENOENT)
- reset_gpio = -1;
- else if (ret)
- return ret;
- reset_gpio = desc_to_gpio(rst_gpio);
+ if (IS_ERR(rst_gpio)) {
+ ret = PTR_ERR(rst_gpio);
+ if (ret == -ENOENT)
+ reset_gpio = -1;
+ else if (ret)
+ return ret;
+ } else {
+ reset_gpio = desc_to_gpio(rst_gpio);
+ }
} else {
if (cpu_is_pxa27x())
reset_gpio = 113;
---
base-commit: 66672af7a095d89f082c5327f3b15bc2f93d558e
change-id: 20260413-ac97-83224a44ed37
Best regards,
--
Peng Fan <peng.fan@nxp.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ASoC: pxa2xx-ac97: fix error handling for reset GPIO descriptor
2026-04-13 10:52 [PATCH] ASoC: pxa2xx-ac97: fix error handling for reset GPIO descriptor Peng Fan (OSS)
@ 2026-04-13 17:02 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-04-13 17:02 UTC (permalink / raw)
To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Jaroslav Kysela,
Takashi Iwai, Peng Fan (OSS)
Cc: linux-arm-kernel, linux-sound, linux-kernel, Peng Fan,
kernel test robot, Dan Carpenter
On Mon, 13 Apr 2026 18:52:43 +0800, Peng Fan (OSS) wrote:
> ASoC: pxa2xx-ac97: fix error handling for reset GPIO descriptor
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.1
Thanks!
[1/1] ASoC: pxa2xx-ac97: fix error handling for reset GPIO descriptor
https://git.kernel.org/broonie/sound/c/54a032d3e62f
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-14 16:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-13 10:52 [PATCH] ASoC: pxa2xx-ac97: fix error handling for reset GPIO descriptor Peng Fan (OSS)
2026-04-13 17:02 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox