From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx> Successful of_irq_parse_pci() invocation will increase refcount of OF device node @oirq.np, but API of_irq_parse_and_map_pci() does not decrease the refcount before return, so cause @oirq.np refcount leakage. Fix by using OF __free() to decrease the refcount. Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx> Cc: Rob Herring (Arm) <robh@xxxxxxxxxx> --- drivers/pci/of.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index ab7a8252bf4137a17971c3eb8ab70ce78ca70969..0a5cba7df1bc918dc537d187c145b9fd73c520b7 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -576,6 +576,7 @@ static int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args * */ int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin) { + struct device_node *np __free(device_node) = NULL; struct of_phandle_args oirq; int ret; @@ -583,6 +584,7 @@ int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin) if (ret) return 0; /* Proper return code 0 == NO_IRQ */ + np = oirq.np; return irq_create_of_mapping(&oirq); } EXPORT_SYMBOL_GPL(of_irq_parse_and_map_pci); -- 2.34.1