GPIO fixes for v5.3-rc1

- silence error messages on probe deferral in gpio-davinci
 - fix a memory leak in gpiolib-of
 - fix a potential use-after-free error in gpio-em
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAl0sTXoACgkQEacuoBRx
 13IwUw//RY5GfIrQYJ6kIqUIntLAmqoosJp/DqYstvByKeR6ca6/kpD93nH+uDQL
 OBhP0/FTKefvjfADha5RLee/ee3fIxsVYW76YJh8mwKh8xKWdvZhe9ZfpD4c88Zg
 6khUNKE0+uI2RMQ3FRKWE79CNPfllxfUVHTlVLJJOFcrLqDkQqxsVowFiisnWMQI
 cpjJZJSnq9fSmTMglTY4XEdI8hFZEJrkM6+FEbF/oW46HDx/XKyasIebXfR9d2ce
 o1/AmylR4PAo9w61mWk7oN6TM3MZcCC7nIw0yIJvuzRtRxk3dpdvXIlzCmLU6yHf
 IvWHbDYxaY3oQO9aYggZk088nHWC39b30Z+cJwSgB+pGYcETPHWdO1nUtN61FU6y
 lfsiR184LrLBHX7pBYJrfeQo7y/xHcSLhZxpT4WAQE/OtFS351OpV9LbBahoflGn
 xm3eaN2Zl+YgQ8w29XYKpLc7jpBanQZ2BU86JL77DDQxpqQOb8SgmdQnIxhGwfxE
 NS63h8XdYGIB1MioAh9QjeRQ8EIqzwTy3/RxpG+0B3qmwx9CfeFW19pa4pLNHx1V
 4IVg8p2XmbxU2eY4uGc7qFQCVYX8/0yClIa90e4xnyAG9xsbkzNssdvEaPq/QccT
 rNvPlW0c5HpSw8OAZQfhZlwhKFKCge9Rf37i8Yk0RVOWd9V+eW4=
 =QeTx
 -----END PGP SIGNATURE-----

Merge tag 'gpio-v5.3-rc1-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into fixes

GPIO fixes for v5.3-rc1

- silence error messages on probe deferral in gpio-davinci
- fix a memory leak in gpiolib-of
- fix a potential use-after-free error in gpio-em
This commit is contained in:
Linus Walleij 2019-07-16 11:12:14 +02:00
commit 88785b7fa7
3 changed files with 19 additions and 20 deletions

View File

@ -238,6 +238,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
for (i = 0; i < nirq; i++) {
chips->irqs[i] = platform_get_irq(pdev, i);
if (chips->irqs[i] < 0) {
if (chips->irqs[i] != -EPROBE_DEFER)
dev_info(dev, "IRQ not populated, err = %d\n",
chips->irqs[i]);
return chips->irqs[i];

View File

@ -259,6 +259,13 @@ static const struct irq_domain_ops em_gio_irq_domain_ops = {
.xlate = irq_domain_xlate_twocell,
};
static void em_gio_irq_domain_remove(void *data)
{
struct irq_domain *domain = data;
irq_domain_remove(domain);
}
static int em_gio_probe(struct platform_device *pdev)
{
struct em_gio_priv *p;
@ -333,38 +340,29 @@ static int em_gio_probe(struct platform_device *pdev)
return -ENXIO;
}
ret = devm_add_action_or_reset(&pdev->dev, em_gio_irq_domain_remove,
p->irq_domain);
if (ret)
return ret;
if (devm_request_irq(&pdev->dev, irq[0]->start,
em_gio_irq_handler, 0, name, p)) {
dev_err(&pdev->dev, "failed to request low IRQ\n");
ret = -ENOENT;
goto err1;
return -ENOENT;
}
if (devm_request_irq(&pdev->dev, irq[1]->start,
em_gio_irq_handler, 0, name, p)) {
dev_err(&pdev->dev, "failed to request high IRQ\n");
ret = -ENOENT;
goto err1;
return -ENOENT;
}
ret = devm_gpiochip_add_data(&pdev->dev, gpio_chip, p);
if (ret) {
dev_err(&pdev->dev, "failed to add GPIO controller\n");
goto err1;
}
return 0;
err1:
irq_domain_remove(p->irq_domain);
return ret;
}
static int em_gio_remove(struct platform_device *pdev)
{
struct em_gio_priv *p = platform_get_drvdata(pdev);
irq_domain_remove(p->irq_domain);
return 0;
}
@ -376,7 +374,6 @@ MODULE_DEVICE_TABLE(of, em_gio_dt_ids);
static struct platform_driver em_gio_device_driver = {
.probe = em_gio_probe,
.remove = em_gio_remove,
.driver = {
.name = "em_gio",
.of_match_table = em_gio_dt_ids,

View File

@ -154,6 +154,7 @@ static void of_gpio_flags_quirks(struct device_node *np,
of_node_full_name(child));
*flags |= OF_GPIO_ACTIVE_LOW;
}
of_node_put(child);
break;
}
}