public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 1/2] soc: sifive: ccache: fix missing iounmap() in error path in sifive_ccache_init()
@ 2022-10-17  8:44 Yang Yingliang
  2022-10-17  8:44 ` [PATCH 2/2] soc: sifive: ccache: fix missing free_irq() " Yang Yingliang
  2022-10-17 15:46 ` [PATCH 1/2] soc: sifive: ccache: fix missing iounmap() " Conor Dooley
  0 siblings, 2 replies; 5+ messages in thread
From: Yang Yingliang @ 2022-10-17  8:44 UTC (permalink / raw)
  To: linux-riscv; +Cc: yash.shah, palmer, paul.walmsley

Add missing iounmap() before return error from sifive_ccache_init().

Fixes: a967a289f169 ("RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/soc/sifive/sifive_ccache.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/soc/sifive/sifive_ccache.c b/drivers/soc/sifive/sifive_ccache.c
index 1c171150e878..25019c16d8ae 100644
--- a/drivers/soc/sifive/sifive_ccache.c
+++ b/drivers/soc/sifive/sifive_ccache.c
@@ -222,13 +222,16 @@ static int __init sifive_ccache_init(void)
 	if (!ccache_base)
 		return -ENOMEM;
 
-	if (of_property_read_u32(np, "cache-level", &level))
-		return -ENOENT;
+	if (of_property_read_u32(np, "cache-level", &level)) {
+		rc = -ENOENT;
+		goto err_unmap;
+	}
 
 	intr_num = of_property_count_u32_elems(np, "interrupts");
 	if (!intr_num) {
 		pr_err("No interrupts property\n");
-		return -ENODEV;
+		rc = -ENODEV;
+		goto err_unmap;
 	}
 
 	for (i = 0; i < intr_num; i++) {
@@ -237,7 +240,7 @@ static int __init sifive_ccache_init(void)
 				 NULL);
 		if (rc) {
 			pr_err("Could not request IRQ %d\n", g_irq[i]);
-			return rc;
+			goto err_unmap;
 		}
 	}
 
@@ -250,6 +253,10 @@ static int __init sifive_ccache_init(void)
 	setup_sifive_debug();
 #endif
 	return 0;
+
+err_unmap:
+	iounmap(ccache_base);
+	return rc;
 }
 
 device_initcall(sifive_ccache_init);
-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2022-10-18  1:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-17  8:44 [PATCH 1/2] soc: sifive: ccache: fix missing iounmap() in error path in sifive_ccache_init() Yang Yingliang
2022-10-17  8:44 ` [PATCH 2/2] soc: sifive: ccache: fix missing free_irq() " Yang Yingliang
2022-10-17 15:49   ` Conor Dooley
2022-10-17 15:46 ` [PATCH 1/2] soc: sifive: ccache: fix missing iounmap() " Conor Dooley
2022-10-18  1:50   ` Yang Yingliang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox