Skip to content

Commit

Permalink
Merge branch irq/refcount into irq/irqchip-next
Browse files Browse the repository at this point in the history
* irq/refcount:
  : .
  : Set of OF refcount fixes from  Miaoqian Lin, adding an
  : of_node_put() call after of_irq_find_parent() calls.
  : .
  irqchip/ti-sci: Fix refcount leak in ti_sci_intr_irq_domain_probe
  irqchip/irq-mvebu-gicp: Fix refcount leak in mvebu_gicp_probe
  irqchip/alpine-msi: Fix refcount leak in alpine_msix_init_domains
  irqchip: Fix refcount leak in platform_irqchip_probe

Signed-off-by: Marc Zyngier <maz@kernel.org>
  • Loading branch information
Marc Zyngier committed Feb 6, 2023
2 parents 6360ec8 + 02298b7 commit 5f61c69
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/irqchip/irq-alpine-msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ static int alpine_msix_init_domains(struct alpine_msix_data *priv,
}

gic_domain = irq_find_host(gic_node);
of_node_put(gic_node);
if (!gic_domain) {
pr_err("Failed to find the GIC domain\n");
return -ENXIO;
Expand Down
1 change: 1 addition & 0 deletions drivers/irqchip/irq-mvebu-gicp.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ static int mvebu_gicp_probe(struct platform_device *pdev)
}

parent_domain = irq_find_host(irq_parent_dn);
of_node_put(irq_parent_dn);
if (!parent_domain) {
dev_err(&pdev->dev, "failed to find parent IRQ domain\n");
return -ENODEV;
Expand Down
1 change: 1 addition & 0 deletions drivers/irqchip/irq-ti-sci-intr.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ static int ti_sci_intr_irq_domain_probe(struct platform_device *pdev)
}

parent_domain = irq_find_host(parent_node);
of_node_put(parent_node);
if (!parent_domain) {
dev_err(dev, "Failed to find IRQ parent domain\n");
return -ENODEV;
Expand Down
8 changes: 6 additions & 2 deletions drivers/irqchip/irqchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ int platform_irqchip_probe(struct platform_device *pdev)
struct device_node *par_np = of_irq_find_parent(np);
of_irq_init_cb_t irq_init_cb = of_device_get_match_data(&pdev->dev);

if (!irq_init_cb)
if (!irq_init_cb) {
of_node_put(par_np);
return -EINVAL;
}

if (par_np == np)
par_np = NULL;
Expand All @@ -52,8 +54,10 @@ int platform_irqchip_probe(struct platform_device *pdev)
* interrupt controller. The actual initialization callback of this
* interrupt controller can check for specific domains as necessary.
*/
if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY))
if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY)) {
of_node_put(par_np);
return -EPROBE_DEFER;
}

return irq_init_cb(np, par_np);
}
Expand Down

0 comments on commit 5f61c69

Please sign in to comment.