[PATCH 2/2] ASoC: codecs: rt5659: propagate GPIO errors

From: phucduc . bui

Date: Fri Oct 09 2026 - 07:26:13 EST


From: bui duc phuc <phucduc.bui@xxxxxxxxx>

devm_gpiod_get_optional() may return an error pointer, including
-EPROBE_DEFER, but rt5659_i2c_probe() does not handle these errors
for the ldo1-en GPIO and does not check for errors for the reset GPIO.

Check the return values and propagate GPIO lookup errors.

Fixes: d3cb2de2479b ("ASoC: rt5659: add rt5659 codec driver")
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/soc/codecs/rt5659.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt5659.c b/sound/soc/codecs/rt5659.c
index 3097ee6d4e89..b40dc9c50139 100644
--- a/sound/soc/codecs/rt5659.c
+++ b/sound/soc/codecs/rt5659.c
@@ -4113,10 +4113,14 @@ static int rt5659_i2c_probe(struct i2c_client *i2c)
rt5659->gpiod_ldo1_en = devm_gpiod_get_optional(&i2c->dev, "ldo1-en",
GPIOD_OUT_HIGH);
if (IS_ERR(rt5659->gpiod_ldo1_en))
- dev_warn(&i2c->dev, "Request ldo1-en GPIO failed\n");
+ return dev_err_probe(&i2c->dev, PTR_ERR(rt5659->gpiod_ldo1_en),
+ "failed to get ldo1-en GPIO\n");

rt5659->gpiod_reset = devm_gpiod_get_optional(&i2c->dev, "reset",
GPIOD_OUT_HIGH);
+ if (IS_ERR(rt5659->gpiod_reset))
+ return dev_err_probe(&i2c->dev, PTR_ERR(rt5659->gpiod_reset),
+ "failed to get reset GPIO\n");

/* Sleep for 300 ms minimum */
msleep(300);
--
2.43.0