diff options
| author | Felix Gu <ustc.gu@gmail.com> | 2026-01-30 20:49:09 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-03-25 13:06:05 +0300 |
| commit | d0a466caf4ace74188db9d22d26a097b3e600bcc (patch) | |
| tree | 8f340a65a4fe1ab7336f2562e73013560e1c9c6b /drivers/cache | |
| parent | ccb2262681d6b1fccdef4a9d2f6290f1b2c5c7a4 (diff) | |
| download | linux-d0a466caf4ace74188db9d22d26a097b3e600bcc.tar.xz | |
cache: ax45mp: Fix device node reference leak in ax45mp_cache_init()
[ Upstream commit 0528a348b04b327a4611e29589beb4c9ae81304a ]
In ax45mp_cache_init(), of_find_matching_node() returns a device node
with an incremented reference count that must be released with
of_node_put(). The current code fails to call of_node_put() which
causes a reference leak.
Use the __free(device_node) attribute to ensure automatic cleanup when
the variable goes out of scope.
Fixes: d34599bcd2e4 ("cache: Add L2 cache management for Andes AX45MP RISC-V core")
Signed-off-by: Felix Gu <ustc.gu@gmail.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/ax45mp_cache.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/cache/ax45mp_cache.c b/drivers/cache/ax45mp_cache.c index 1d7dd3d2c101..934c5087ec2b 100644 --- a/drivers/cache/ax45mp_cache.c +++ b/drivers/cache/ax45mp_cache.c @@ -178,11 +178,11 @@ static const struct of_device_id ax45mp_cache_ids[] = { static int __init ax45mp_cache_init(void) { - struct device_node *np; struct resource res; int ret; - np = of_find_matching_node(NULL, ax45mp_cache_ids); + struct device_node *np __free(device_node) = + of_find_matching_node(NULL, ax45mp_cache_ids); if (!of_device_is_available(np)) return -ENODEV; |
