Skip to content

Commit

Permalink
powerpc/iommu: Add missing of_node_put in iommu_init_early_dart
Browse files Browse the repository at this point in the history
[ Upstream commit 57b742a ]

The device_node pointer is returned by of_find_compatible_node
with refcount incremented. We should use of_node_put() to avoid
the refcount leak.

Signed-off-by: Peng Wu <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Peng Wu authored and gregkh committed Jun 9, 2022
1 parent 787255e commit df6d8b6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/powerpc/sysdev/dart_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,10 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops)
}

/* Initialize the DART HW */
if (dart_init(dn) != 0)
if (dart_init(dn) != 0) {
of_node_put(dn);
return;

}
/*
* U4 supports a DART bypass, we use it for 64-bit capable devices to
* improve performance. However, that only works for devices connected
Expand All @@ -419,6 +420,7 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops)

/* Setup pci_dma ops */
set_pci_dma_ops(&dma_iommu_ops);
of_node_put(dn);
}

#ifdef CONFIG_PM
Expand Down

0 comments on commit df6d8b6

Please sign in to comment.