* [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
* [PATCH v2 1/1] pinctrl: mediatek: correct error handling
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
1 sibling, 0 replies; 3+ messages in thread
From: Chunfeng Yun @ 2020-12-28 1:27 UTC (permalink / raw)
To: u-boot
On Sun, 2020-12-27 at 21:18 +0100, Heinrich Schuchardt wrote:
> 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;
> --
Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Thanks
> 2.29.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/1] pinctrl: mediatek: correct error handling
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
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2021-01-19 13:06 UTC (permalink / raw)
To: u-boot
On Sun, Dec 27, 2020 at 09:18:26PM +0100, Heinrich Schuchardt wrote:
> 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>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210119/c797462f/attachment.sig>
^ permalink raw reply [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.