[patch] pinctrl: mediatek: signedness bug in mtk_pmx_gpio_request_enable()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"muxval" stores a value from 0-255 or a negative error code.  It has to
be signed for the error handling to work.

Fixes: 59ee9c96dd5d ('pinctrl: mediatek: Add gpio_request_enable support')
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index cbc2204..1fbaf28 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -755,14 +755,14 @@ 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);
 
 	if (muxval < 0) {
 		dev_err(pctl->dev, "invalid gpio pin %d.\n", offset);
-		return -EINVAL;
+		return muxval;
 	}
 
 	mtk_pmx_set_mode(pctldev, offset, muxval);
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux