BCM2712D0's sparse GPIO map revealed that it is not safe to treat
group_selector as the GPIO number - it is an index into the array of
pinctrl_pin_descs, and the "number" member says which GPIO it refers to.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
unsigned group_selector)
{
struct bcm2712_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev);
+ const struct pinctrl_desc *pctldesc = &pc->pctl_desc;
+ const struct pinctrl_pin_desc *pindesc;
- bcm2712_pinctrl_fsel_set(pc, group_selector, func_selector);
+ if (group_selector >= pctldesc->npins)
+ return -EINVAL;
+ pindesc = &pctldesc->pins[group_selector];
+ bcm2712_pinctrl_fsel_set(pc, pindesc->number, func_selector);
return 0;
}