Skip to content

Commit 15a6847

Browse files
ISCAS-Vulabgregkh
authored andcommitted
pinctrl: single: Fix incorrect type for error return variable
[ Upstream commit 61d1bb5 ] 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: 9dddb4d ("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>
1 parent 495f3e9 commit 15a6847

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/pinctrl/pinctrl-single.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,8 @@ static int pcs_pinconf_get(struct pinctrl_dev *pctldev,
485485
struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
486486
struct pcs_function *func;
487487
enum pin_config_param param;
488-
unsigned offset = 0, data = 0, i, j, ret;
488+
unsigned offset = 0, data = 0, i, j;
489+
int ret;
489490

490491
ret = pcs_get_function(pctldev, pin, &func);
491492
if (ret)
@@ -549,9 +550,9 @@ static int pcs_pinconf_set(struct pinctrl_dev *pctldev,
549550
{
550551
struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
551552
struct pcs_function *func;
552-
unsigned offset = 0, shift = 0, i, data, ret;
553+
unsigned offset = 0, shift = 0, i, data;
553554
u32 arg;
554-
int j;
555+
int j, ret;
555556
enum pin_config_param param;
556557

557558
ret = pcs_get_function(pctldev, pin, &func);

0 commit comments

Comments
 (0)