mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
gpio fixes for v6.0-rc7
- fix a NULL-pointer dereference at driver unbind and a potential resource leak in error path in gpio-mockup - make the irqchip immutable in gpio-ftgpio010 - fix dereferencing a potentially uninitialized variable in gpio-tqmx86 - fix interrupt registering in gpiolib's character device code -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmMsNLoACgkQEacuoBRx 13LdeBAApTXQb/AYIRKNJ06jB6GbZU0dH+X5fkr5u1EY8zCc2xshOgCiczI8zqir n3CoEXuekhpqL4cDr+rXX/fCPgED3s0RDTIrswwPFnvvmlr7yPbVIokecEUbzA40 I7CKV/MtkDIvw05MGjiDWmk3SQZdWVrh5RaZclyxt3KXWIA6fu6T319tRf1C9UWt KQHsku15c8FEtwXjGjSUCEyKp53cXu+SNbUlkxwXbyov8ab+zWSzL0mDICRJkJYo Ort2y1G2zUubphQ4HLK3AGPDmhHxl52R+MTg5Mcutx/HfpWvm8+Vy6b58v91ycg2 r4/8LUprFE3XI4+bIRWqftfl9CrTxLJzKUhUb4okExrGurOR+SHnvkYygUn4uef2 jmKd0EUHYOsoJUryGYpIPuvXQpR/YoRkYEXNXGbeXghKzAbonYMsPaaUbGaGvwG4 vgPBKcWPTXVda0bR5Vl1wkeN6422dwU/SQ+vN32Xgl/qszmIHPfzWz+FgpfN4L/R X2HMIoQ02h8uc2JC1R9H5bwbvVFrWI47XwIqh8xFf8UYZ7aUEI9hpm9CeVJDpbra EkQxft82GJ9GOt8QAakwQdlInoYp7OLEee1QAvaKJV8Psbydk5WarpB9R/0cqldP bbnTzrY4J+ZfNz1F1U7jYRAjSnChvW4d3b9AdwTVFdvpWFD4X68= =BBWZ -----END PGP SIGNATURE----- Merge tag 'gpio-fixes-for-v6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux Pull gpio fixes from Bartosz Golaszewski: - fix a NULL-pointer dereference at driver unbind and a potential resource leak in error path in gpio-mockup - make the irqchip immutable in gpio-ftgpio010 - fix dereferencing a potentially uninitialized variable in gpio-tqmx86 - fix interrupt registering in gpiolib's character device code * tag 'gpio-fixes-for-v6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpiolib: cdev: Set lineevent_state::irq after IRQ register successfully gpio: tqmx86: fix uninitialized variable girq gpio: ftgpio010: Make irqchip immutable gpio: mockup: Fix potential resource leakage when register a chip gpio: mockup: fix NULL pointer dereference when removing debugfs
This commit is contained in:
commit
5e0a93e427
@ -41,14 +41,12 @@
|
||||
* struct ftgpio_gpio - Gemini GPIO state container
|
||||
* @dev: containing device for this instance
|
||||
* @gc: gpiochip for this instance
|
||||
* @irq: irqchip for this instance
|
||||
* @base: remapped I/O-memory base
|
||||
* @clk: silicon clock
|
||||
*/
|
||||
struct ftgpio_gpio {
|
||||
struct device *dev;
|
||||
struct gpio_chip gc;
|
||||
struct irq_chip irq;
|
||||
void __iomem *base;
|
||||
struct clk *clk;
|
||||
};
|
||||
@ -70,6 +68,7 @@ static void ftgpio_gpio_mask_irq(struct irq_data *d)
|
||||
val = readl(g->base + GPIO_INT_EN);
|
||||
val &= ~BIT(irqd_to_hwirq(d));
|
||||
writel(val, g->base + GPIO_INT_EN);
|
||||
gpiochip_disable_irq(gc, irqd_to_hwirq(d));
|
||||
}
|
||||
|
||||
static void ftgpio_gpio_unmask_irq(struct irq_data *d)
|
||||
@ -78,6 +77,7 @@ static void ftgpio_gpio_unmask_irq(struct irq_data *d)
|
||||
struct ftgpio_gpio *g = gpiochip_get_data(gc);
|
||||
u32 val;
|
||||
|
||||
gpiochip_enable_irq(gc, irqd_to_hwirq(d));
|
||||
val = readl(g->base + GPIO_INT_EN);
|
||||
val |= BIT(irqd_to_hwirq(d));
|
||||
writel(val, g->base + GPIO_INT_EN);
|
||||
@ -221,6 +221,16 @@ static int ftgpio_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct irq_chip ftgpio_irq_chip = {
|
||||
.name = "FTGPIO010",
|
||||
.irq_ack = ftgpio_gpio_ack_irq,
|
||||
.irq_mask = ftgpio_gpio_mask_irq,
|
||||
.irq_unmask = ftgpio_gpio_unmask_irq,
|
||||
.irq_set_type = ftgpio_gpio_set_irq_type,
|
||||
.flags = IRQCHIP_IMMUTABLE,
|
||||
GPIOCHIP_IRQ_RESOURCE_HELPERS,
|
||||
};
|
||||
|
||||
static int ftgpio_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
@ -277,14 +287,8 @@ static int ftgpio_gpio_probe(struct platform_device *pdev)
|
||||
if (!IS_ERR(g->clk))
|
||||
g->gc.set_config = ftgpio_gpio_set_config;
|
||||
|
||||
g->irq.name = "FTGPIO010";
|
||||
g->irq.irq_ack = ftgpio_gpio_ack_irq;
|
||||
g->irq.irq_mask = ftgpio_gpio_mask_irq;
|
||||
g->irq.irq_unmask = ftgpio_gpio_unmask_irq;
|
||||
g->irq.irq_set_type = ftgpio_gpio_set_irq_type;
|
||||
|
||||
girq = &g->gc.irq;
|
||||
girq->chip = &g->irq;
|
||||
gpio_irq_chip_set_chip(girq, &ftgpio_irq_chip);
|
||||
girq->parent_handler = ftgpio_gpio_irq_handler;
|
||||
girq->num_parents = 1;
|
||||
girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents),
|
||||
|
@ -533,8 +533,10 @@ static int __init gpio_mockup_register_chip(int idx)
|
||||
}
|
||||
|
||||
fwnode = fwnode_create_software_node(properties, NULL);
|
||||
if (IS_ERR(fwnode))
|
||||
if (IS_ERR(fwnode)) {
|
||||
kfree_strarray(line_names, ngpio);
|
||||
return PTR_ERR(fwnode);
|
||||
}
|
||||
|
||||
pdevinfo.name = "gpio-mockup";
|
||||
pdevinfo.id = idx;
|
||||
@ -597,9 +599,9 @@ static int __init gpio_mockup_init(void)
|
||||
|
||||
static void __exit gpio_mockup_exit(void)
|
||||
{
|
||||
gpio_mockup_unregister_pdevs();
|
||||
debugfs_remove_recursive(gpio_mockup_dbg_dir);
|
||||
platform_driver_unregister(&gpio_mockup_driver);
|
||||
gpio_mockup_unregister_pdevs();
|
||||
}
|
||||
|
||||
module_init(gpio_mockup_init);
|
||||
|
@ -307,6 +307,8 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
|
||||
girq->default_type = IRQ_TYPE_NONE;
|
||||
girq->handler = handle_simple_irq;
|
||||
girq->init_valid_mask = tqmx86_init_irq_valid_mask;
|
||||
|
||||
irq_domain_set_pm_device(girq->domain, dev);
|
||||
}
|
||||
|
||||
ret = devm_gpiochip_add_data(dev, chip, gpio);
|
||||
@ -315,8 +317,6 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
|
||||
goto out_pm_dis;
|
||||
}
|
||||
|
||||
irq_domain_set_pm_device(girq->domain, dev);
|
||||
|
||||
dev_info(dev, "GPIO functionality initialized with %d pins\n",
|
||||
chip->ngpio);
|
||||
|
||||
|
@ -1986,7 +1986,6 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
|
||||
ret = -ENODEV;
|
||||
goto out_free_le;
|
||||
}
|
||||
le->irq = irq;
|
||||
|
||||
if (eflags & GPIOEVENT_REQUEST_RISING_EDGE)
|
||||
irqflags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ?
|
||||
@ -2000,7 +1999,7 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
|
||||
init_waitqueue_head(&le->wait);
|
||||
|
||||
/* Request a thread to read the events */
|
||||
ret = request_threaded_irq(le->irq,
|
||||
ret = request_threaded_irq(irq,
|
||||
lineevent_irq_handler,
|
||||
lineevent_irq_thread,
|
||||
irqflags,
|
||||
@ -2009,6 +2008,8 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
|
||||
if (ret)
|
||||
goto out_free_le;
|
||||
|
||||
le->irq = irq;
|
||||
|
||||
fd = get_unused_fd_flags(O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) {
|
||||
ret = fd;
|
||||
|
Loading…
Reference in New Issue
Block a user