pinctrl: mediatek: fix handling return value of mtk_pmx_find_gpio_mode
authorAndrzej Hajda <a.hajda@samsung.com>
Thu, 11 Feb 2016 14:34:08 +0000 (15:34 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 15 Feb 2016 23:30:21 +0000 (00:30 +0100)
The function can return negative values, so its result should
be assigned to signed variable.

The problem has been detected using coccinelle semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci.

Fixes: 59ee9c9 ('pinctrl: mediatek: Add gpio_request_enable support')
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Acked-by: Hongzhou Yang <hongzhou.yang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/mediatek/pinctrl-mtk-common.c

index b752f5aee6a4b859e582fd1cfa9d47e52bfeee3a..6024483dd336826661e730fd57ad292d6e1a2336 100644 (file)
@@ -753,7 +753,7 @@ static int mtk_pmx_gpio_request_enable(struct pinctrl_dev *pctldev,
                                    struct pinctrl_gpio_range *range,
                                    unsigned offset)
 {
-       unsigned long muxval;
+       int muxval;
        struct mtk_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
 
        muxval = mtk_pmx_find_gpio_mode(pctl, offset);