[PATCH 09/15] ASoC: mediatek: mt8192: check return values in mt8192_afe_gpio_init()

From: phucduc . bui

Date: Fri Sep 18 2026 - 10:42:19 EST


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

Currently, mt8192_afe_gpio_init() ignores the return values of
mt8192_afe_gpio_select() and mt8192_afe_gpio_request(). If configuring
GPIO states or requesting GPIOs fails during initialization, the function
still proceeds and returns 0, masking the initialization failure.

Fix this by checking and propagating the return values properly.

Fixes: 125ab5d588b0 ("ASoC: mediatek: mt8192: add platform driver")
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/soc/mediatek/mt8192/mt8192-afe-gpio.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sound/soc/mediatek/mt8192/mt8192-afe-gpio.c b/sound/soc/mediatek/mt8192/mt8192-afe-gpio.c
index d4218f9708f7..d2e99c55b8c6 100644
--- a/sound/soc/mediatek/mt8192/mt8192-afe-gpio.c
+++ b/sound/soc/mediatek/mt8192/mt8192-afe-gpio.c
@@ -147,13 +147,17 @@ int mt8192_afe_gpio_init(struct device *dev)
}
}

- mt8192_afe_gpio_select(dev, MT8192_AFE_GPIO_CLK_MOSI_ON);
+ ret = mt8192_afe_gpio_select(dev, MT8192_AFE_GPIO_CLK_MOSI_ON);
+ if (ret)
+ return ret;

/* gpio status init */
- mt8192_afe_gpio_request(dev, false, MT8192_DAI_ADDA, 0);
- mt8192_afe_gpio_request(dev, false, MT8192_DAI_ADDA, 1);
+ ret = mt8192_afe_gpio_request(dev, false, MT8192_DAI_ADDA, 0);
+ if (ret)
+ return ret;
+ ret = mt8192_afe_gpio_request(dev, false, MT8192_DAI_ADDA, 1);

- return 0;
+ return ret;
}
EXPORT_SYMBOL(mt8192_afe_gpio_init);

--
2.43.0