mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 01:32:21 +02:00
gpio: davinci: fix IRQ domain leak on devm_kzalloc failure
In davinci_gpio_irq_setup(), after successfully creating an IRQ domain
with irq_domain_create_legacy(), a subsequent devm_kzalloc() failure
in the bank loop causes the function to return -ENOMEM without
removing the IRQ domain.
Unlike devm-managed resources, irq_domain_create_legacy() does not
auto-clean up on probe failure, so the domain is leaked.
Fix by calling irq_domain_remove() before returning on allocation
failure.
Fixes: b5cf3fd827 ("gpio: davinci: Redesign driver to accommodate ngpios in one gpio chip")
Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn>
Link: https://patch.msgid.link/20260623023106.117229-1-fffsqian@163.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
This commit is contained in:
parent
d3e91a95b2
commit
4e8eb6952a
|
|
@ -568,8 +568,10 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
|
|||
sizeof(struct
|
||||
davinci_gpio_irq_data),
|
||||
GFP_KERNEL);
|
||||
if (!irqdata)
|
||||
if (!irqdata) {
|
||||
irq_domain_remove(chips->irq_domain);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
irqdata->regs = g;
|
||||
irqdata->bank_num = bank;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user