[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5534F1F3.9060802@cogentembedded.com>
Date: Mon, 20 Apr 2015 15:32:51 +0300
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Colin King <colin.king@...onical.com>,
Linus Walleij <linus.walleij@...aro.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Hongzhou Yang <hongzhou.yang@...iatek.com>,
Yingjoe Chen <yingjoe.chen@...iatek.com>,
Maoguang Meng <maoguang.meng@...iatek.com>,
linux-gpio@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
CC: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] pinctrl: mediatek: mtk-common: initialize unmask
Hello.
On 04/20/2015 02:15 PM, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.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@...onical.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists