All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Colin King <colin.king@canonical.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Hongzhou Yang <hongzhou.yang@mediatek.com>,
	Yingjoe Chen <yingjoe.chen@mediatek.com>,
	Maoguang Meng <maoguang.meng@mediatek.com>,
	linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pinctrl: mediatek: mtk-common: initialize unmask
Date: Mon, 20 Apr 2015 15:32:51 +0300	[thread overview]
Message-ID: <5534F1F3.9060802@cogentembedded.com> (raw)
In-Reply-To: <1429528516-9245-1-git-send-email-colin.king@canonical.com>

Hello.

On 04/20/2015 02:15 PM, Colin King wrote:

> From: Colin Ian King <colin.king@canonical.com>

> cppcheck detected an unitialized variable:

    Uninitialized.

> [drivers/pinctrl/mediatek/pinctrl-mtk-common.c:897]:
>    (error) Uninitialized variable: unmask

> unmask should be initialized to zero to ensure unmasking
> only occurs if a previous mask occurred. The current situation
> is that the unmask variable could contain any random garbage
> causing random unexpected unmasking.

> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index 493294c..3173125 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -881,7 +881,8 @@ static int mtk_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
>   	if (!mtk_eint_get_mask(pctl, eint_num)) {
>   		mtk_eint_mask(d);
>   		unmask = 1;
> -	}
> +	} else
> +		unmask = 0;

    The CodingStyle dictates that there should be {} around *else* branch too.

[...]

WBR, Sergei


WARNING: multiple messages have this Message-ID (diff)
From: sergei.shtylyov@cogentembedded.com (Sergei Shtylyov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] pinctrl: mediatek: mtk-common: initialize unmask
Date: Mon, 20 Apr 2015 15:32:51 +0300	[thread overview]
Message-ID: <5534F1F3.9060802@cogentembedded.com> (raw)
In-Reply-To: <1429528516-9245-1-git-send-email-colin.king@canonical.com>

Hello.

On 04/20/2015 02:15 PM, Colin King wrote:

> From: Colin Ian King <colin.king@canonical.com>

> cppcheck detected an unitialized variable:

    Uninitialized.

> [drivers/pinctrl/mediatek/pinctrl-mtk-common.c:897]:
>    (error) Uninitialized variable: unmask

> unmask should be initialized to zero to ensure unmasking
> only occurs if a previous mask occurred. The current situation
> is that the unmask variable could contain any random garbage
> causing random unexpected unmasking.

> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index 493294c..3173125 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -881,7 +881,8 @@ static int mtk_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
>   	if (!mtk_eint_get_mask(pctl, eint_num)) {
>   		mtk_eint_mask(d);
>   		unmask = 1;
> -	}
> +	} else
> +		unmask = 0;

    The CodingStyle dictates that there should be {} around *else* branch too.

[...]

WBR, Sergei

  reply	other threads:[~2015-04-20 12:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-20 11:15 [PATCH] pinctrl: mediatek: mtk-common: initialize unmask Colin King
2015-04-20 11:15 ` Colin King
2015-04-20 12:32 ` Sergei Shtylyov [this message]
2015-04-20 12:32   ` Sergei Shtylyov

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=5534F1F3.9060802@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=colin.king@canonical.com \
    --cc=hongzhou.yang@mediatek.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=maoguang.meng@mediatek.com \
    --cc=matthias.bgg@gmail.com \
    --cc=yingjoe.chen@mediatek.com \
    /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.