Skip to content

Commit

Permalink
amba: bus: fix refcount leak
Browse files Browse the repository at this point in the history
[ Upstream commit e312cbdc11305568554a9e18a2ea5c2492c183f3 ]

commit 5de1540 ("drivers/amba: create devices from device tree")
increases the refcount of of_node, but not releases it in
amba_device_release, so there is refcount leak. By using of_node_put
to avoid refcount leak.

Fixes: 5de1540 ("drivers/amba: create devices from device tree")
Signed-off-by: Peng Fan <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
MrVan authored and gregkh committed Sep 23, 2023
1 parent 73e355b commit 94e398d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/amba/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ static void amba_device_release(struct device *dev)
{
struct amba_device *d = to_amba_device(dev);

of_node_put(d->dev.of_node);
if (d->res.parent)
release_resource(&d->res);
kfree(d);
Expand Down

0 comments on commit 94e398d

Please sign in to comment.