stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5.15 0/3] sifive ccache error handling backports for 5.15
@ 2023-04-21 13:58 Conor Dooley
  2023-04-21 13:58 ` [PATCH 5.15 1/3] soc: sifive: l2_cache: fix missing iounmap() in error path in sifive_l2_init() Conor Dooley
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Conor Dooley @ 2023-04-21 13:58 UTC (permalink / raw)
  To: stable
  Cc: conor, conor.dooley, Greg Kroah-Hartman, Greentime Hu, Zong Li,
	Palmer Dabbelt, Sasha Levin

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(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 5.15 1/3] soc: sifive: l2_cache: fix missing iounmap() in error path in sifive_l2_init()
  2023-04-21 13:58 [PATCH 5.15 0/3] sifive ccache error handling backports for 5.15 Conor Dooley
@ 2023-04-21 13:58 ` Conor Dooley
  2023-04-21 13:58 ` [PATCH 5.15 2/3] soc: sifive: l2_cache: fix missing free_irq() " Conor Dooley
  2023-04-21 13:58 ` [PATCH 5.15 3/3] soc: sifive: l2_cache: fix missing of_node_put() " Conor Dooley
  2 siblings, 0 replies; 6+ messages in thread
From: Conor Dooley @ 2023-04-21 13:58 UTC (permalink / raw)
  To: stable
  Cc: conor, conor.dooley, Greg Kroah-Hartman, Greentime Hu, Zong Li,
	Palmer Dabbelt, Sasha Levin, Yang Yingliang

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);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5.15 2/3] soc: sifive: l2_cache: fix missing free_irq() in error path in sifive_l2_init()
  2023-04-21 13:58 [PATCH 5.15 0/3] sifive ccache error handling backports for 5.15 Conor Dooley
  2023-04-21 13:58 ` [PATCH 5.15 1/3] soc: sifive: l2_cache: fix missing iounmap() in error path in sifive_l2_init() Conor Dooley
@ 2023-04-21 13:58 ` Conor Dooley
  2023-04-23 13:11   ` Greg Kroah-Hartman
  2023-04-21 13:58 ` [PATCH 5.15 3/3] soc: sifive: l2_cache: fix missing of_node_put() " Conor Dooley
  2 siblings, 1 reply; 6+ messages in thread
From: Conor Dooley @ 2023-04-21 13:58 UTC (permalink / raw)
  To: stable
  Cc: conor, conor.dooley, Greg Kroah-Hartman, Greentime Hu, Zong Li,
	Palmer Dabbelt, Sasha Levin, Yang Yingliang

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;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5.15 3/3] soc: sifive: l2_cache: fix missing of_node_put() in sifive_l2_init()
  2023-04-21 13:58 [PATCH 5.15 0/3] sifive ccache error handling backports for 5.15 Conor Dooley
  2023-04-21 13:58 ` [PATCH 5.15 1/3] soc: sifive: l2_cache: fix missing iounmap() in error path in sifive_l2_init() Conor Dooley
  2023-04-21 13:58 ` [PATCH 5.15 2/3] soc: sifive: l2_cache: fix missing free_irq() " Conor Dooley
@ 2023-04-21 13:58 ` Conor Dooley
  2 siblings, 0 replies; 6+ messages in thread
From: Conor Dooley @ 2023-04-21 13:58 UTC (permalink / raw)
  To: stable
  Cc: conor, conor.dooley, Greg Kroah-Hartman, Greentime Hu, Zong Li,
	Palmer Dabbelt, Sasha Levin, Yang Yingliang

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);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 5.15 2/3] soc: sifive: l2_cache: fix missing free_irq() in error path in sifive_l2_init()
  2023-04-21 13:58 ` [PATCH 5.15 2/3] soc: sifive: l2_cache: fix missing free_irq() " Conor Dooley
@ 2023-04-23 13:11   ` Greg Kroah-Hartman
  2023-04-24  9:30     ` Conor Dooley
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-04-23 13:11 UTC (permalink / raw)
  To: Conor Dooley
  Cc: stable, conor, Greentime Hu, Zong Li, Palmer Dabbelt, Sasha Levin,
	Yang Yingliang

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 5.15 2/3] soc: sifive: l2_cache: fix missing free_irq() in error path in sifive_l2_init()
  2023-04-23 13:11   ` Greg Kroah-Hartman
@ 2023-04-24  9:30     ` Conor Dooley
  0 siblings, 0 replies; 6+ messages in thread
From: Conor Dooley @ 2023-04-24  9:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: stable, conor, Greentime Hu, Zong Li, Palmer Dabbelt, Sasha Levin,
	Yang Yingliang

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

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.

Done, <20230424-slingshot-knelt-7a2f81b422a3@wendy>.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-24  9:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-21 13:58 [PATCH 5.15 0/3] sifive ccache error handling backports for 5.15 Conor Dooley
2023-04-21 13:58 ` [PATCH 5.15 1/3] soc: sifive: l2_cache: fix missing iounmap() in error path in sifive_l2_init() Conor Dooley
2023-04-21 13:58 ` [PATCH 5.15 2/3] soc: sifive: l2_cache: fix missing free_irq() " Conor Dooley
2023-04-23 13:11   ` Greg Kroah-Hartman
2023-04-24  9:30     ` Conor Dooley
2023-04-21 13:58 ` [PATCH 5.15 3/3] soc: sifive: l2_cache: fix missing of_node_put() " Conor Dooley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).