public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] soc: amlogic: Fix refcount leak in meson-secure-pwrc.c
@ 2022-06-16 14:49 Liang He
  2022-06-16 20:17 ` Martin Blumenstingl
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Liang He @ 2022-06-16 14:49 UTC (permalink / raw)
  To: narmstrong, khilman, jbrunet, martin.blumenstingl
  Cc: windhl, linux-arm-kernel, linux-amlogic, linux-kernel

In meson_secure_pwrc_probe(), there is a refcount leak in one fail
path.

Signed-off-by: Liang He <windhl@126.com>
---
 drivers/soc/amlogic/meson-secure-pwrc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/amlogic/meson-secure-pwrc.c b/drivers/soc/amlogic/meson-secure-pwrc.c
index a10a417a87db..e93518763526 100644
--- a/drivers/soc/amlogic/meson-secure-pwrc.c
+++ b/drivers/soc/amlogic/meson-secure-pwrc.c
@@ -152,8 +152,10 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev)
 	}
 
 	pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL);
-	if (!pwrc)
+	if (!pwrc) {
+		of_node_put(sm_np);
 		return -ENOMEM;
+	}
 
 	pwrc->fw = meson_sm_get(sm_np);
 	of_node_put(sm_np);
-- 
2.25.1


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

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

end of thread, other threads:[~2022-06-17  7:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-16 14:49 [PATCH] soc: amlogic: Fix refcount leak in meson-secure-pwrc.c Liang He
2022-06-16 20:17 ` Martin Blumenstingl
2022-06-17  1:22   ` Liang He
2022-06-17  7:31 ` Neil Armstrong
2022-06-17  7:41 ` Neil Armstrong

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