diff options
| author | Felix Gu <ustc.gu@gmail.com> | 2026-01-30 20:13:45 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-03-25 13:10:38 +0300 |
| commit | 606fcf901c132ed87286d8b3d06a0fff36256c84 (patch) | |
| tree | 3aceaf1ab56fc6b368be48f7f1a3bfe611c26465 /drivers/cache | |
| parent | e3dd5cffba07de6574165a72851471cd42cc6d15 (diff) | |
| download | linux-606fcf901c132ed87286d8b3d06a0fff36256c84.tar.xz | |
cache: starfive: fix device node leak in starlink_cache_init()
[ Upstream commit 3c85234b979af71cb9db5eb976ea08a468415767 ]
of_find_matching_node() returns a device_node with refcount incremented.
Use __free(device_node) attribute to automatically call of_node_put()
when the variable goes out of scope, preventing the refcount leak.
Fixes: cabff60ca77d ("cache: Add StarFive StarLink cache management")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/cache')
| -rw-r--r-- | drivers/cache/starfive_starlink_cache.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/cache/starfive_starlink_cache.c b/drivers/cache/starfive_starlink_cache.c index 24c7d078ca22..3a25d2d7c70c 100644 --- a/drivers/cache/starfive_starlink_cache.c +++ b/drivers/cache/starfive_starlink_cache.c @@ -102,11 +102,11 @@ static const struct of_device_id starlink_cache_ids[] = { static int __init starlink_cache_init(void) { - struct device_node *np; u32 block_size; int ret; - np = of_find_matching_node(NULL, starlink_cache_ids); + struct device_node *np __free(device_node) = + of_find_matching_node(NULL, starlink_cache_ids); if (!of_device_is_available(np)) return -ENODEV; |
