Skip to content

Commit

Permalink
pinctrl: mediatek: mtk-common: initialize unmask
Browse files Browse the repository at this point in the history
cppcheck detected an uninitialized variable:

[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>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Colin Ian King authored and Linus Walleij committed May 4, 2015
1 parent 4e637ac commit 74d77e5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/pinctrl/mediatek/pinctrl-mtk-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +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;
}

clr_bit = 0xff << eint_offset;
Expand Down

0 comments on commit 74d77e5

Please sign in to comment.