All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] pinctrl: mediatek: correct error handling
@ 2020-12-27 20:18 Heinrich Schuchardt
  2020-12-28  1:27 ` Chunfeng Yun
  2021-01-19 13:06 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2020-12-27 20:18 UTC (permalink / raw)
  To: u-boot

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>
---
v2:
	move the assigment to the certain code-path (Andy)
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 1 +
 1 file changed, 1 insertion(+)

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-19 13:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-27 20:18 [PATCH v2 1/1] pinctrl: mediatek: correct error handling Heinrich Schuchardt
2020-12-28  1:27 ` Chunfeng Yun
2021-01-19 13:06 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.