[PATCH] PCI: mediatek-gen3: Fix refcount leak in mtk_pcie_init_irq_domains
Miles Chen
miles.chen at mediatek.com
Sun May 29 19:19:23 PDT 2022
Hi Miaoqian,
>>> &intx_domain_ops, pcie);
>>> if (!pcie->intx_domain) {
>>> dev_err(dev, "failed to create INTx IRQ domain\n");
>>> + of_node_put(intc_node);
>>> return -ENODEV;
>>> }
>> Thanks for doing this.
>>
>> I checked mtk_pcie_init_irq_domains() and there are multiple exit paths like
>> err_msi_domain and err_msi_bottom_domain and the normal path which also
>> need of_node_put(intc_node).
>
>Thanks for your reply,
>
>I didn't add of_node_put() in other paths because I am not sure if the reference passed through irq_domain_add_linear(), since intc_node is passed to irq_domain_add_linear().
>
>__irq_domain_add() keeps &node->fwnode in the irq_domain structure.
>
>and use fwnode_handle_get() to get the reference of fwnode, but I still uncertain.
>
>If the reference don't needed anymore after irq_domain_add_linear(),
>
>your suggestion looks fine, and I will submit v2.
Thanks for your reply, I think we can do similar things like
rtl8365mb_irq_setup() in drivers/net/dsa/realtek/rtl8365mb.c
Thanks,
Miles
More information about the linux-arm-kernel
mailing list