1
0
Fork 0

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
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAl/ItYMACgkQEacuoBRx
 13JY0A/8CQ9wrdLU8r008xpkqkqS/QodopLA05veBp0+DSTCWkUPfVGijcgvDWP8
 poRvQpyTK5rQKytLE+5PV7r0q+I6hPrjh6lwhjA5uexhxyLfkEr9jsnbkAh+mTHS
 C++Tl90qpqSoQvXFbpzy65lR0ETd63vurhp/Ss0yK9HezV74534fR5evXPqGEllV
 OSwAee3AJRnlLdO7RcCvhIeyVcfdYCrT+8+yEF419qO37vGw+GlPRlqn/GNtRXdK
 8bk1/2FrnlEvPihDhoFf2BKway+2XT8xh58Ix//sXu1e8PSRwfK9LriF+meeHw5I
 tYBT+o1+5WmWe+Mw4ajtnM6VMVjxQwyxH71LKW1+Len7oz/0m1Q5H5bnDJ5GlCWp
 1BTlcJT2fr8YODcrrb+JAEEt8JLr2kyY1nzWmfTfTX2B+R4IRslLBlcOul+dOWO1
 HtwsktWd0QlgLS7Wq2FNdY0i6MgEXPwz2j8aKplTeqjStQLRMJsaBzUVgDGSeY2A
 yWkxRUuVHfBjJBUVvUAkze4cs23CtRHVL6s9u5hqYQ1A/lKr6p0AEI5EYXX4js8Y
 LN+yNLxKydF33O+9PpnZgl2BHOZ7tnKkth+5lGwOe0TL1lam1tCqqbTqIgIMEdcJ
 +ay/f/uPtkm52kgC8iunpJpkRC+sxWj/jTMVXZdRzTgHBfbGBJ0=
 =zVTi
 -----END PGP SIGNATURE-----

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
zero-sugar-mainline-defconfig
Linus Walleij 2020-12-04 09:14:56 +01:00
commit 77c12bf383
5 changed files with 21 additions and 7 deletions

View File

@ -192,6 +192,7 @@ static int arizona_gpio_probe(struct platform_device *pdev)
ret = devm_gpiochip_add_data(&pdev->dev, &arizona_gpio->gpio_chip,
arizona_gpio);
if (ret < 0) {
pm_runtime_disable(&pdev->dev);
dev_err(&pdev->dev, "Could not register gpiochip, %d\n",
ret);
return ret;

View File

@ -724,6 +724,8 @@ static int dwapb_gpio_probe(struct platform_device *pdev)
return err;
}
platform_set_drvdata(pdev, gpio);
return 0;
}

View File

@ -1197,6 +1197,13 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
devm_gpiochip_add_data(&pdev->dev, &mvchip->chip, mvchip);
/* Some MVEBU SoCs have simple PWM support for GPIO lines */
if (IS_ENABLED(CONFIG_PWM)) {
err = mvebu_pwm_probe(pdev, mvchip, id);
if (err)
return err;
}
/* Some gpio controllers do not provide irq support */
if (!have_irqs)
return 0;
@ -1206,7 +1213,8 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
if (!mvchip->domain) {
dev_err(&pdev->dev, "couldn't allocate irq domain %s (DT).\n",
mvchip->chip.label);
return -ENODEV;
err = -ENODEV;
goto err_pwm;
}
err = irq_alloc_domain_generic_chips(
@ -1254,14 +1262,12 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
mvchip);
}
/* Some MVEBU SoCs have simple PWM support for GPIO lines */
if (IS_ENABLED(CONFIG_PWM))
return mvebu_pwm_probe(pdev, mvchip, id);
return 0;
err_domain:
irq_domain_remove(mvchip->domain);
err_pwm:
pwmchip_remove(&mvchip->mvpwm->chip);
return err;
}

View File

@ -574,7 +574,7 @@ static int zynq_gpio_irq_reqres(struct irq_data *d)
struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
int ret;
ret = pm_runtime_get_sync(chip->parent);
ret = pm_runtime_resume_and_get(chip->parent);
if (ret < 0)
return ret;
@ -942,7 +942,7 @@ static int zynq_gpio_probe(struct platform_device *pdev)
pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
ret = pm_runtime_get_sync(&pdev->dev);
ret = pm_runtime_resume_and_get(&pdev->dev);
if (ret < 0)
goto err_pm_dis;

View File

@ -1806,6 +1806,11 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_request);
*/
void gpiochip_generic_free(struct gpio_chip *gc, unsigned offset)
{
#ifdef CONFIG_PINCTRL
if (list_empty(&gc->gpiodev->pin_ranges))
return;
#endif
pinctrl_gpio_free(gc->gpiodev->base + offset);
}
EXPORT_SYMBOL_GPL(gpiochip_generic_free);