diff options
author | Colin Ian King <colin.king@canonical.com> | 2018-09-25 12:55:56 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2018-09-26 10:43:01 +0300 |
commit | 7a52127e3cf170ae71dadefef4ec82fb600cde2d (patch) | |
tree | 8b546d35b60e7826b011f2b3cadca8c0f827465e /drivers/pinctrl/mediatek | |
parent | 22eb8301dbc1d0c916c9b826094e4d7562e1491e (diff) | |
download | linux-7a52127e3cf170ae71dadefef4ec82fb600cde2d.tar.xz |
pinctrl: mediatek: fix check on EINT_NA comparison
Currently, the check on desc->eint.eint_n == EINT_NA is always false
because this is comparing a u16 to -1 which can never be true. Fix
this by casting EINT_NA to u16.
Detected by CoverityScan, CID#1473610 ("Operands don't affect result")
Fixes: fb5fa8dc151b ("pinctrl: mediatek: extend struct mtk_pin_desc to pinctrl-mtk-common-v2.c")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/mediatek')
-rw-r--r-- | drivers/pinctrl/mediatek/pinctrl-moore.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c index 3bf5dd552749..3133ec0f2e67 100644 --- a/drivers/pinctrl/mediatek/pinctrl-moore.c +++ b/drivers/pinctrl/mediatek/pinctrl-moore.c @@ -476,7 +476,7 @@ static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) desc = (const struct mtk_pin_desc *)&hw->soc->pins[offset]; - if (desc->eint.eint_n == EINT_NA) + if (desc->eint.eint_n == (u16)EINT_NA) return -ENOTSUPP; return mtk_eint_find_irq(hw->eint, desc->eint.eint_n); @@ -493,7 +493,7 @@ static int mtk_gpio_set_config(struct gpio_chip *chip, unsigned int offset, if (!hw->eint || pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE || - desc->eint.eint_n == EINT_NA) + desc->eint.eint_n == (u16)EINT_NA) return -ENOTSUPP; debounce = pinconf_to_config_argument(config); |