[PATCH 1/1] pinctrl: mediatek: correct error handling

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Dec 27 11:39:49 CET 2020


If no GPIO controller is found, the return value should not depend on a
random value on the stack. Initialize variable ret.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 6553dde45c..8b4e0e32c5 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -608,7 +608,7 @@ static int mtk_gpiochip_register(struct udevice *parent)
 {
 	struct uclass_driver *drv;
 	struct udevice *dev;
-	int ret;
+	int ret = -ENOENT;
 	ofnode node;

 	drv = lists_uclass_lookup(UCLASS_GPIO);
--
2.29.2



More information about the U-Boot mailing list