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>
This commit is contained in:
Heinrich Schuchardt 2020-12-27 21:18:26 +01:00 committed by Tom Rini
parent c65b7d1acf
commit 97bf73762f

View File

@ -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;