From: Heinrich Schuchardt Date: Sun, 27 Dec 2020 20:18:26 +0000 (+0100) Subject: pinctrl: mediatek: correct error handling X-Git-Url: http://git.dujemihanovic.xyz/img/%7B%7B%20.RelPermalink%20%7D%7D?a=commitdiff_plain;h=97bf73762fed743291bb7e572aa659374990b93d;p=u-boot.git 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 Acked-by: Chunfeng Yun --- 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;