All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soc: aspeed: Fix a reference leak in aspeed_socinfo_init()
@ 2020-11-13 10:08 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-11-13 10:08 UTC (permalink / raw)
  To: Joel Stanley
  Cc: Andrew Jeffery, Tom Rix, linux-aspeed, linux-kernel, kernel-janitors

This needs to call of_node_put(np) before returning if of_iomap() fails.

Fixes: e0218dca5787 ("soc: aspeed: Add soc info driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/soc/aspeed/aspeed-socinfo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/aspeed/aspeed-socinfo.c b/drivers/soc/aspeed/aspeed-socinfo.c
index 20a1d4aeb051..773930e0cb10 100644
--- a/drivers/soc/aspeed/aspeed-socinfo.c
+++ b/drivers/soc/aspeed/aspeed-socinfo.c
@@ -74,8 +74,10 @@ static int __init aspeed_socinfo_init(void)
 	}
 
 	reg = of_iomap(np, 0);
-	if (!reg)
+	if (!reg) {
+		of_node_put(np);
 		return -ENODEV;
+	}
 	siliconid = readl(reg);
 	iounmap(reg);
 
-- 
2.28.0


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

* [PATCH] soc: aspeed: Fix a reference leak in aspeed_socinfo_init()
@ 2020-11-13 10:08 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-11-13 10:08 UTC (permalink / raw)
  To: Joel Stanley
  Cc: Andrew Jeffery, Tom Rix, linux-aspeed, linux-kernel, kernel-janitors

This needs to call of_node_put(np) before returning if of_iomap() fails.

Fixes: e0218dca5787 ("soc: aspeed: Add soc info driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/soc/aspeed/aspeed-socinfo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/aspeed/aspeed-socinfo.c b/drivers/soc/aspeed/aspeed-socinfo.c
index 20a1d4aeb051..773930e0cb10 100644
--- a/drivers/soc/aspeed/aspeed-socinfo.c
+++ b/drivers/soc/aspeed/aspeed-socinfo.c
@@ -74,8 +74,10 @@ static int __init aspeed_socinfo_init(void)
 	}
 
 	reg = of_iomap(np, 0);
-	if (!reg)
+	if (!reg) {
+		of_node_put(np);
 		return -ENODEV;
+	}
 	siliconid = readl(reg);
 	iounmap(reg);
 
-- 
2.28.0

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

* Re: [PATCH] soc: aspeed: Fix a reference leak in aspeed_socinfo_init()
  2020-11-13 10:08 ` Dan Carpenter
@ 2020-11-16  4:22   ` Andrew Jeffery
  -1 siblings, 0 replies; 4+ messages in thread
From: Andrew Jeffery @ 2020-11-16  4:10 UTC (permalink / raw)
  To: Dan Carpenter, Joel Stanley
  Cc: Tom Rix, linux-aspeed, linux-kernel, kernel-janitors



On Fri, 13 Nov 2020, at 20:38, Dan Carpenter wrote:
> This needs to call of_node_put(np) before returning if of_iomap() fails.
> 
> Fixes: e0218dca5787 ("soc: aspeed: Add soc info driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Andrew Jeffery <andrew@aj.id.au>

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

* Re: [PATCH] soc: aspeed: Fix a reference leak in aspeed_socinfo_init()
@ 2020-11-16  4:22   ` Andrew Jeffery
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Jeffery @ 2020-11-16  4:22 UTC (permalink / raw)
  To: Dan Carpenter, Joel Stanley
  Cc: Tom Rix, linux-aspeed, linux-kernel, kernel-janitors



On Fri, 13 Nov 2020, at 20:38, Dan Carpenter wrote:
> This needs to call of_node_put(np) before returning if of_iomap() fails.
> 
> Fixes: e0218dca5787 ("soc: aspeed: Add soc info driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Andrew Jeffery <andrew@aj.id.au>

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

end of thread, other threads:[~2020-11-16  4:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 10:08 [PATCH] soc: aspeed: Fix a reference leak in aspeed_socinfo_init() Dan Carpenter
2020-11-13 10:08 ` Dan Carpenter
2020-11-16  4:10 ` Andrew Jeffery
2020-11-16  4:22   ` Andrew Jeffery

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.