Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

of/irq: add missing of_node_put() for interrupt parent node

After calling of_irq_parse_one(), the node provided in the of_phandle_args
has a refcount increment by one. Add missing of_node_put in of_irq_get()
to decrement the refcount once used.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
Link: https://lore.kernel.org/r/20230117144929.423089-1-clement.leger@bootlin.com
Signed-off-by: Rob Herring <robh@kernel.org>

authored by

Clément Léger and committed by
Rob Herring
eb2b4ecf 7e38085d

+9 -3
+9 -3
drivers/of/irq.c
··· 438 438 return rc; 439 439 440 440 domain = irq_find_host(oirq.np); 441 - if (!domain) 442 - return -EPROBE_DEFER; 441 + if (!domain) { 442 + rc = -EPROBE_DEFER; 443 + goto out; 444 + } 443 445 444 - return irq_create_of_mapping(&oirq); 446 + rc = irq_create_of_mapping(&oirq); 447 + out: 448 + of_node_put(oirq.np); 449 + 450 + return rc; 445 451 } 446 452 EXPORT_SYMBOL_GPL(of_irq_get); 447 453