summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-12-27 21:18:26 +0100
committerTom Rini <trini@konsulko.com>2021-01-18 15:23:06 -0500
commit97bf73762fed743291bb7e572aa659374990b93d (patch)
tree718194067045c1846a16935172b7f818e76a87cd
parentc65b7d1acfffda1a73bcea2cd0d2bc43ce54540f (diff)
downloadu-boot-97bf73762fed743291bb7e572aa659374990b93d.tar.gz
pinctrl: mediatek: correct error handling
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@gmx.de> Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
-rw-r--r--drivers/pinctrl/mediatek/pinctrl-mtk-common.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 6553dde45c..4dd3f73ead 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -615,6 +615,7 @@ static int mtk_gpiochip_register(struct udevice *parent)
if (!drv)
return -ENOENT;
+ ret = -ENOENT;
dev_for_each_subnode(node, parent)
if (ofnode_read_bool(node, "gpio-controller")) {
ret = 0;