cache: ax45mp: Fix device node reference leak in ax45mp_cache_init()
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: d34599bcd2 ("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>
This commit is contained in:
parent
3c85234b97
commit
0528a348b0
|
|
@ -178,11 +178,11 @@ static const struct of_device_id ax45mp_cache_ids[] = {
|
||||||
|
|
||||||
static int __init ax45mp_cache_init(void)
|
static int __init ax45mp_cache_init(void)
|
||||||
{
|
{
|
||||||
struct device_node *np;
|
|
||||||
struct resource res;
|
struct resource res;
|
||||||
int ret;
|
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))
|
if (!of_device_is_available(np))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue