summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/sprd
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-09-07 14:12:05 +0300
committerLinus Walleij <linus.walleij@linaro.org>2017-09-12 12:27:36 +0300
commit4ce504c4eb5628073f35d38efe490554a12aee04 (patch)
tree16e635bcdc7069d4241c7d4c95643e61cb13f0ac /drivers/pinctrl/sprd
parent41470c379b4f8d9a1513d930338fadfbccc287b6 (diff)
downloadlinux-4ce504c4eb5628073f35d38efe490554a12aee04.tar.xz
pinctrl: sprd: fix off by one bugs
info->groups[] has info->ngroups elements so these comparisons should be >= instead of >. Fixes: 41d32cfce1ae ("pinctrl: sprd: Add Spreadtrum pin control driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Baolin Wang <baolin.wang@spreadtrum.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/sprd')
-rw-r--r--drivers/pinctrl/sprd/pinctrl-sprd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c
index e52a01e1f662..63529911445c 100644
--- a/drivers/pinctrl/sprd/pinctrl-sprd.c
+++ b/drivers/pinctrl/sprd/pinctrl-sprd.c
@@ -400,7 +400,7 @@ static int sprd_pmx_set_mux(struct pinctrl_dev *pctldev,
unsigned long reg;
unsigned int val = 0;
- if (group_selector > info->ngroups)
+ if (group_selector >= info->ngroups)
return -EINVAL;
switch (func_selector) {
@@ -734,7 +734,7 @@ static int sprd_pinconf_group_get(struct pinctrl_dev *pctldev,
struct sprd_pin_group *grp;
unsigned int pin_id;
- if (selector > info->ngroups)
+ if (selector >= info->ngroups)
return -EINVAL;
grp = &info->groups[selector];
@@ -753,7 +753,7 @@ static int sprd_pinconf_group_set(struct pinctrl_dev *pctldev,
struct sprd_pin_group *grp;
int ret, i;
- if (selector > info->ngroups)
+ if (selector >= info->ngroups)
return -EINVAL;
grp = &info->groups[selector];
@@ -813,7 +813,7 @@ static void sprd_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
const char *name;
int i, ret;
- if (selector > info->ngroups)
+ if (selector >= info->ngroups)
return;
grp = &info->groups[selector];