ASoC: codecs: rt5659: propagate GPIO errors

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: d3cb2de247 ("ASoC: rt5659: add rt5659 codec driver")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
Link: https://patch.msgid.link/20261009112204.33199-2-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
bui duc phuc 2026-10-09 18:22:04 +07:00 committed by Mark Brown
parent 50fb7f7fc7
commit c1e321bd5c
No known key found for this signature in database
GPG Key ID: 2FEF73B0B3D03889

View File

@ -4121,10 +4121,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);