mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 17:41:44 +00:00
powerpc/8xx: Fix possible device node reference leak
The call to of_find_compatible_node() returns a node pointer with
refcount incremented thus it must be explicitly decremented after the
last usage.
irq_domain_add_linear() also calls of_node_get() to increase refcount,
so irq_domain() will not be affected when it is released.
Detected by coccinelle.
Fixes: a8db8cf0d8
("irq_domain: Replace irq_alloc_host() with revmap-specific initializers")
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Suggested-by: Christophe Leroy <christophe.leroy@c-s.fr>
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Peng Hao <peng.hao2@zte.com.cn>
Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
7f177f9810
commit
cc76404fea
@ -153,10 +153,9 @@ int mpc8xx_pic_init(void)
|
||||
if (mpc8xx_pic_host == NULL) {
|
||||
printk(KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n");
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
return 0;
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
of_node_put(np);
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user