All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 1/1] pinctrl: mediatek: correct error handling
Date: Mon, 28 Dec 2020 09:27:29 +0800	[thread overview]
Message-ID: <1609118849.6658.1.camel@mhfsdcap03> (raw)
In-Reply-To: <20201227201826.104658-1-xypron.glpk@gmx.de>

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
> 

  reply	other threads:[~2020-12-28  1:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-27 20:18 [PATCH v2 1/1] pinctrl: mediatek: correct error handling Heinrich Schuchardt
2020-12-28  1:27 ` Chunfeng Yun [this message]
2021-01-19 13:06 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1609118849.6658.1.camel@mhfsdcap03 \
    --to=chunfeng.yun@mediatek.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.