]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pinctrl: single: Fix incorrect type for error return variable
authorHaotian Zhang <vulab@iscas.ac.cn>
Wed, 3 Dec 2025 06:13:47 +0000 (14:13 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 12:55:14 +0000 (13:55 +0100)
[ Upstream commit 61d1bb53547d42c6bdaec9da4496beb3a1a05264 ]

pcs_pinconf_get() and pcs_pinconf_set() declare ret as unsigned int,
but assign it the return values of pcs_get_function() that may return
negative error codes. This causes negative error codes to be
converted to large positive values.

Change ret from unsigned int to int in both functions.

Fixes: 9dddb4df90d1 ("pinctrl: single: support generic pinconf")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pinctrl/pinctrl-single.c

index 1df0a00ae1ee88be8229604db844b3f25ef6ac7d..2218d65a7d842b8714bc337232bc4df70688177e 100644 (file)
@@ -485,7 +485,8 @@ static int pcs_pinconf_get(struct pinctrl_dev *pctldev,
        struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
        struct pcs_function *func;
        enum pin_config_param param;
-       unsigned offset = 0, data = 0, i, j, ret;
+       unsigned offset = 0, data = 0, i, j;
+       int ret;
 
        ret = pcs_get_function(pctldev, pin, &func);
        if (ret)
@@ -549,9 +550,9 @@ static int pcs_pinconf_set(struct pinctrl_dev *pctldev,
 {
        struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
        struct pcs_function *func;
-       unsigned offset = 0, shift = 0, i, data, ret;
+       unsigned offset = 0, shift = 0, i, data;
        u32 arg;
-       int j;
+       int j, ret;
        enum pin_config_param param;
 
        ret = pcs_get_function(pctldev, pin, &func);