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>

authored by

Dan Carpenter and committed by
Linus Walleij
4ce504c4 41470c37

+4 -4
+4 -4
drivers/pinctrl/sprd/pinctrl-sprd.c
··· 400 400 unsigned long reg; 401 401 unsigned int val = 0; 402 402 403 - if (group_selector > info->ngroups) 403 + if (group_selector >= info->ngroups) 404 404 return -EINVAL; 405 405 406 406 switch (func_selector) { ··· 734 734 struct sprd_pin_group *grp; 735 735 unsigned int pin_id; 736 736 737 - if (selector > info->ngroups) 737 + if (selector >= info->ngroups) 738 738 return -EINVAL; 739 739 740 740 grp = &info->groups[selector]; ··· 753 753 struct sprd_pin_group *grp; 754 754 int ret, i; 755 755 756 - if (selector > info->ngroups) 756 + if (selector >= info->ngroups) 757 757 return -EINVAL; 758 758 759 759 grp = &info->groups[selector]; ··· 813 813 const char *name; 814 814 int i, ret; 815 815 816 - if (selector > info->ngroups) 816 + if (selector >= info->ngroups) 817 817 return; 818 818 819 819 grp = &info->groups[selector];