Skip to content

Commit 77c12bf

Browse files
author
Linus Walleij
committed
Merge tag 'gpio-fixes-for-v5.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into fixes
gpio fixes for v5.10-rc7 - disable pm_runtime in error path in gpio-arizona - fix a NULL pointer dereference in gpio-dwapb - fix a resource leak in gpio-zynq - balance the freeing of pinctrl ranges if PINCTRL is not selected - fix a potential use-after-free error in gpio-mvebu
2 parents b650545 + 7ee1a01 commit 77c12bf

5 files changed

Lines changed: 21 additions & 7 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-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)