Following up on: https://lore.kernel.org/stable/20230412-mustang-machine-e9fccdb6b81c@wendy/
Here's some backports that do pull back the rename of the driver and Kconfig symbol etc.
CC: stable@vger.kernel.org CC: Greg Kroah-Hartman gregkh@linuxfoundation.org CC: Greentime Hu greentime.hu@sifive.com CC: Zong Li zong.li@sifive.com CC: Palmer Dabbelt palmer@rivosinc.com CC: Sasha Levin sashal@kernel.org
Yang Yingliang (3): soc: sifive: l2_cache: fix missing iounmap() in error path in sifive_l2_init() soc: sifive: l2_cache: fix missing free_irq() in error path in sifive_l2_init() soc: sifive: l2_cache: fix missing of_node_put() in sifive_l2_init()
drivers/soc/sifive/sifive_l2_cache.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
From: Yang Yingliang yangyingliang@huawei.com
commit 73e770f085023da327dc9ffeb6cd96b0bb22d97e upstream.
Add missing iounmap() before return error from sifive_l2_init().
Fixes: a967a289f169 ("RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs") Signed-off-by: Yang Yingliang yangyingliang@huawei.com Reviewed-by: Conor Dooley conor.dooley@microchip.com Signed-off-by: Conor Dooley conor.dooley@microchip.com [conor: ccache -> l2_cache] Signed-off-by: Conor Dooley conor.dooley@microchip.com --- drivers/soc/sifive/sifive_l2_cache.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/sifive/sifive_l2_cache.c b/drivers/soc/sifive/sifive_l2_cache.c index 59640a1d0b28..483aeaf0d405 100644 --- a/drivers/soc/sifive/sifive_l2_cache.c +++ b/drivers/soc/sifive/sifive_l2_cache.c @@ -212,7 +212,8 @@ static int __init sifive_l2_init(void) intr_num = of_property_count_u32_elems(np, "interrupts"); if (!intr_num) { pr_err("L2CACHE: no interrupts property\n"); - return -ENODEV; + rc = -ENODEV; + goto err_unmap; }
for (i = 0; i < intr_num; i++) { @@ -220,7 +221,7 @@ static int __init sifive_l2_init(void) rc = request_irq(g_irq[i], l2_int_handler, 0, "l2_ecc", NULL); if (rc) { pr_err("L2CACHE: Could not request IRQ %d\n", g_irq[i]); - return rc; + goto err_unmap; } }
@@ -233,5 +234,9 @@ static int __init sifive_l2_init(void) setup_sifive_debug(); #endif return 0; + +err_unmap: + iounmap(l2_base); + return rc; } device_initcall(sifive_l2_init);
From: Yang Yingliang yangyingliang@huawei.com
commit 73e770f085023da327dc9ffeb6cd96b0bb22d97e upstream.
Add missing free_irq() before return error from sifive_l2_init().
Fixes: a967a289f169 ("RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs") Signed-off-by: Yang Yingliang yangyingliang@huawei.com Reviewed-by: Conor Dooley conor.dooley@microchip.com Signed-off-by: Conor Dooley conor.dooley@microchip.com [conor: ccache -> l2_cache] Signed-off-by: Conor Dooley conor.dooley@microchip.com --- drivers/soc/sifive/sifive_l2_cache.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/sifive/sifive_l2_cache.c b/drivers/soc/sifive/sifive_l2_cache.c index 483aeaf0d405..1248127009f6 100644 --- a/drivers/soc/sifive/sifive_l2_cache.c +++ b/drivers/soc/sifive/sifive_l2_cache.c @@ -221,7 +221,7 @@ static int __init sifive_l2_init(void) rc = request_irq(g_irq[i], l2_int_handler, 0, "l2_ecc", NULL); if (rc) { pr_err("L2CACHE: Could not request IRQ %d\n", g_irq[i]); - goto err_unmap; + goto err_free_irq; } }
@@ -235,6 +235,9 @@ static int __init sifive_l2_init(void) #endif return 0;
+err_free_irq: + while (--i >= 0) + free_irq(g_irq[i], NULL); err_unmap: iounmap(l2_base); return rc;
On Fri, Apr 21, 2023 at 02:58:17PM +0100, Conor Dooley wrote:
From: Yang Yingliang yangyingliang@huawei.com
commit 73e770f085023da327dc9ffeb6cd96b0bb22d97e upstream.
No, sorry, wrong git id :(
Please fix up and resend the series.
thanks,
greg k-h
On Sun, Apr 23, 2023 at 03:11:48PM +0200, Greg Kroah-Hartman wrote:
On Fri, Apr 21, 2023 at 02:58:17PM +0100, Conor Dooley wrote:
From: Yang Yingliang yangyingliang@huawei.com
commit 73e770f085023da327dc9ffeb6cd96b0bb22d97e upstream.
No, sorry, wrong git id :(
Whoops, guess I did `P` instead of pasting from my systems clipboard.
Please fix up and resend the series.
From: Yang Yingliang yangyingliang@huawei.com
commit 8fbf94fea0b4e187ca9100936c5429f96b8a4e44 upstream.
The device_node pointer returned by of_find_matching_node() with refcount incremented, when finish using it, the refcount need be decreased.
Fixes: a967a289f169 ("RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs") Signed-off-by: Yang Yingliang yangyingliang@huawei.com Reviewed-by: Conor Dooley conor.dooley@microchip.com Signed-off-by: Conor Dooley conor.dooley@microchip.com [conor: cache -> l2_cache] Signed-off-by: Conor Dooley conor.dooley@microchip.com --- drivers/soc/sifive/sifive_l2_cache.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/soc/sifive/sifive_l2_cache.c b/drivers/soc/sifive/sifive_l2_cache.c index 1248127009f6..783158070490 100644 --- a/drivers/soc/sifive/sifive_l2_cache.c +++ b/drivers/soc/sifive/sifive_l2_cache.c @@ -202,12 +202,16 @@ static int __init sifive_l2_init(void) if (!np) return -ENODEV;
- if (of_address_to_resource(np, 0, &res)) - return -ENODEV; + if (of_address_to_resource(np, 0, &res)) { + rc = -ENODEV; + goto err_node_put; + }
l2_base = ioremap(res.start, resource_size(&res)); - if (!l2_base) - return -ENOMEM; + if (!l2_base) { + rc = -ENOMEM; + goto err_node_put; + }
intr_num = of_property_count_u32_elems(np, "interrupts"); if (!intr_num) { @@ -224,6 +228,7 @@ static int __init sifive_l2_init(void) goto err_free_irq; } } + of_node_put(np);
l2_config_read();
@@ -240,6 +245,8 @@ static int __init sifive_l2_init(void) free_irq(g_irq[i], NULL); err_unmap: iounmap(l2_base); +err_node_put: + of_node_put(np); return rc; } device_initcall(sifive_l2_init);
linux-stable-mirror@lists.linaro.org