Skip to content

Commit b7050b2

Browse files
committed
Merge tag 'pinctrl-v5.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control fixes from Linus Walleij: "Two last-minute fixes: - Put an fwnode in the errorpath in the SGPIO driver - Fix the number of GPIO lines per bank in the STM32 driver" * tag 'pinctrl-v5.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: stm32: fix the reported number of GPIO lines per bank pinctrl: microchip-sgpio: Put fwnode in error case during ->probe()
2 parents e2f527b + 67e2996 commit b7050b2

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

drivers/pinctrl/pinctrl-microchip-sgpio.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,10 @@ static int microchip_sgpio_probe(struct platform_device *pdev)
845845
i = 0;
846846
device_for_each_child_node(dev, fwnode) {
847847
ret = microchip_sgpio_register_bank(dev, priv, fwnode, i++);
848-
if (ret)
848+
if (ret) {
849+
fwnode_handle_put(fwnode);
849850
return ret;
851+
}
850852
}
851853

852854
if (priv->in.gpio.ngpio != priv->out.gpio.ngpio) {

drivers/pinctrl/stm32/pinctrl-stm32.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl,
12241224
struct device *dev = pctl->dev;
12251225
struct resource res;
12261226
int npins = STM32_GPIO_PINS_PER_BANK;
1227-
int bank_nr, err;
1227+
int bank_nr, err, i = 0;
12281228

12291229
if (!IS_ERR(bank->rstc))
12301230
reset_control_deassert(bank->rstc);
@@ -1246,9 +1246,14 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl,
12461246

12471247
of_property_read_string(np, "st,bank-name", &bank->gpio_chip.label);
12481248

1249-
if (!of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args)) {
1249+
if (!of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, i, &args)) {
12501250
bank_nr = args.args[1] / STM32_GPIO_PINS_PER_BANK;
12511251
bank->gpio_chip.base = args.args[1];
1252+
1253+
npins = args.args[2];
1254+
while (!of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3,
1255+
++i, &args))
1256+
npins += args.args[2];
12521257
} else {
12531258
bank_nr = pctl->nbanks;
12541259
bank->gpio_chip.base = bank_nr * STM32_GPIO_PINS_PER_BANK;

0 commit comments

Comments
 (0)