public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
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: 2+ 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 12:32 ` Sergei Shtylyov [this message]

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$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox