Skip to content

Commit 6d47cde

Browse files
committed
Merge tag 'v5.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO fixes from Linus Walleij: "These are hopefully the last GPIO fixes for this cycle. All are driver fixes except a small resource leak for pin ranges in the gpiolib. Two are PM related, which is nice because when developers start to find PM bugs it is usually because they have smoked out the bugs of more severe nature. Summary: - Fix runtime PM balancing on the errorpath of the Arizona driver - Fix a suspend NULL pointer reference in the dwapb driver - Balance free:ing in gpiochip_generic_free() - Fix runtime PM balancing on the errorpath of the zynq driver - Fix irqdomain use-after-free in the mvebu driver - Break an eternal loop in the spreadtrum EIC driver" * tag 'v5.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: gpio: eic-sprd: break loop when getting NULL device resource gpio: mvebu: fix potential user-after-free on probe gpio: zynq: fix reference leak in zynq_gpio functions gpiolib: Don't free if pin ranges are not defined gpio: dwapb: fix NULL pointer dereference at dwapb_gpio_suspend() gpio: arizona: disable pm_runtime in case of failure
2 parents c1cea11 + 263ade7 commit 6d47cde

6 files changed

Lines changed: 22 additions & 8 deletions

File tree

drivers/gpio/gpio-arizona.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ static int arizona_gpio_probe(struct platform_device *pdev)
192192
ret = devm_gpiochip_add_data(&pdev->dev, &arizona_gpio->gpio_chip,
193193
arizona_gpio);
194194
if (ret < 0) {
195+
pm_runtime_disable(&pdev->dev);
195196
dev_err(&pdev->dev, "Could not register gpiochip, %d\n",
196197
ret);
197198
return ret;

drivers/gpio/gpio-dwapb.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,8 @@ static int dwapb_gpio_probe(struct platform_device *pdev)
724724
return err;
725725
}
726726

727+
platform_set_drvdata(pdev, gpio);
728+
727729
return 0;
728730
}
729731

drivers/gpio/gpio-eic-sprd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ static int sprd_eic_probe(struct platform_device *pdev)
598598
*/
599599
res = platform_get_resource(pdev, IORESOURCE_MEM, i);
600600
if (!res)
601-
continue;
601+
break;
602602

603603
sprd_eic->base[i] = devm_ioremap_resource(&pdev->dev, res);
604604
if (IS_ERR(sprd_eic->base[i]))

drivers/gpio/gpio-mvebu.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,13 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
11971197

11981198
devm_gpiochip_add_data(&pdev->dev, &mvchip->chip, mvchip);
11991199

1200+
/* Some MVEBU SoCs have simple PWM support for GPIO lines */
1201+
if (IS_ENABLED(CONFIG_PWM)) {
1202+
err = mvebu_pwm_probe(pdev, mvchip, id);
1203+
if (err)
1204+
return err;
1205+
}
1206+
12001207
/* Some gpio controllers do not provide irq support */
12011208
if (!have_irqs)
12021209
return 0;
@@ -1206,7 +1213,8 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
12061213
if (!mvchip->domain) {
12071214
dev_err(&pdev->dev, "couldn't allocate irq domain %s (DT).\n",
12081215
mvchip->chip.label);
1209-
return -ENODEV;
1216+
err = -ENODEV;
1217+
goto err_pwm;
12101218
}
12111219

12121220
err = irq_alloc_domain_generic_chips(
@@ -1254,14 +1262,12 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
12541262
mvchip);
12551263
}
12561264

1257-
/* Some MVEBU SoCs have simple PWM support for GPIO lines */
1258-
if (IS_ENABLED(CONFIG_PWM))
1259-
return mvebu_pwm_probe(pdev, mvchip, id);
1260-
12611265
return 0;
12621266

12631267
err_domain:
12641268
irq_domain_remove(mvchip->domain);
1269+
err_pwm:
1270+
pwmchip_remove(&mvchip->mvpwm->chip);
12651271

12661272
return err;
12671273
}

drivers/gpio/gpio-zynq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ static int zynq_gpio_irq_reqres(struct irq_data *d)
574574
struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
575575
int ret;
576576

577-
ret = pm_runtime_get_sync(chip->parent);
577+
ret = pm_runtime_resume_and_get(chip->parent);
578578
if (ret < 0)
579579
return ret;
580580

@@ -942,7 +942,7 @@ static int zynq_gpio_probe(struct platform_device *pdev)
942942

943943
pm_runtime_set_active(&pdev->dev);
944944
pm_runtime_enable(&pdev->dev);
945-
ret = pm_runtime_get_sync(&pdev->dev);
945+
ret = pm_runtime_resume_and_get(&pdev->dev);
946946
if (ret < 0)
947947
goto err_pm_dis;
948948

drivers/gpio/gpiolib.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,6 +1806,11 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_request);
18061806
*/
18071807
void gpiochip_generic_free(struct gpio_chip *gc, unsigned offset)
18081808
{
1809+
#ifdef CONFIG_PINCTRL
1810+
if (list_empty(&gc->gpiodev->pin_ranges))
1811+
return;
1812+
#endif
1813+
18091814
pinctrl_gpio_free(gc->gpiodev->base + offset);
18101815
}
18111816
EXPORT_SYMBOL_GPL(gpiochip_generic_free);

0 commit comments

Comments
 (0)