Ignore the error return value from mtk_pinconf_bias_set_pupd_r1_r0().
The PUPD/R1/R0 registers only include a small subset of the pins, so
it is normal for this function to return an error for most pins.
Therefore, this error should not be propagated.

This fixes not all pins in a pinmux group being configured in some
cases because the propagated error caused the configuration loop to
exit early.

The rest of the function is refactored to return early on errors to
improve readability.

Signed-off-by: David Lechner <[email protected]>
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 0483d532800..ff7cefcc8de 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -364,11 +364,13 @@ int mtk_pinconf_bias_set_v1(struct udevice *dev, u32 pin, 
bool disable,
        /* set pupd_r1_r0 if pullen_pullsel succeeded */
        err = mtk_pinconf_bias_set_pullen_pullsel(dev, pin, disable, pullup,
                                                  val);
-       if (!err)
-               return mtk_pinconf_bias_set_pupd_r1_r0(dev, pin, disable,
-                                                      pullup, val);
+       if (err)
+               return err;
 
-       return err;
+       /* Not all pins have PUPD/R1/R0 registers, so ignore any error here. */
+       mtk_pinconf_bias_set_pupd_r1_r0(dev, pin, disable, pullup, val);
+
+       return 0;
 }
 
 int mtk_pinconf_bias_set_pu_pd(struct udevice *dev, u32 pin, bool disable,

---
base-commit: d503633a36767d756c7de28305cf0de79440cbc0
change-id: 20260113-pinctrl-mtk-fix-set-bias-v1-349ee75b9202

Best regards,
-- 
David Lechner <[email protected]>

Reply via email to