Commit 8fbf94fe authored by Yang Yingliang's avatar Yang Yingliang Committed by Conor Dooley

soc: sifive: ccache: fix missing of_node_put() in sifive_ccache_init()

The device_node pointer returned by of_find_matching_node() with
refcount incremented, when finish using it, the refcount need be
decreased.

Fixes: a967a289 ("RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs")
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
Signed-off-by: default avatarConor Dooley <conor.dooley@microchip.com>
parent 756344e7
...@@ -215,12 +215,16 @@ static int __init sifive_ccache_init(void) ...@@ -215,12 +215,16 @@ static int __init sifive_ccache_init(void)
if (!np) if (!np)
return -ENODEV; return -ENODEV;
if (of_address_to_resource(np, 0, &res)) if (of_address_to_resource(np, 0, &res)) {
return -ENODEV; rc = -ENODEV;
goto err_node_put;
}
ccache_base = ioremap(res.start, resource_size(&res)); ccache_base = ioremap(res.start, resource_size(&res));
if (!ccache_base) if (!ccache_base) {
return -ENOMEM; rc = -ENOMEM;
goto err_node_put;
}
if (of_property_read_u32(np, "cache-level", &level)) { if (of_property_read_u32(np, "cache-level", &level)) {
rc = -ENOENT; rc = -ENOENT;
...@@ -243,6 +247,7 @@ static int __init sifive_ccache_init(void) ...@@ -243,6 +247,7 @@ static int __init sifive_ccache_init(void)
goto err_free_irq; goto err_free_irq;
} }
} }
of_node_put(np);
ccache_config_read(); ccache_config_read();
...@@ -259,6 +264,8 @@ static int __init sifive_ccache_init(void) ...@@ -259,6 +264,8 @@ static int __init sifive_ccache_init(void)
free_irq(g_irq[i], NULL); free_irq(g_irq[i], NULL);
err_unmap: err_unmap:
iounmap(ccache_base); iounmap(ccache_base);
err_node_put:
of_node_put(np);
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment