[<prev] [next>] [day] [month] [year] [list]
Message-ID: <641ff33c-3687-42d7-933c-484bf3ab595c@web.de>
Date: Tue, 24 Sep 2024 19:30:23 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: linux-amlogic@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org,
Kevin Hilman <khilman@...libre.com>, Jerome Brunet <jbrunet@...libre.com>,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
Neil Armstrong <neil.armstrong@...aro.org>,
Wen Yang <yellowriver2010@...mail.com>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org
Subject: [PATCH] soc: amlogic: canvas: Call of_node_put(canvas_node) only once
in meson_canvas_get()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 24 Sep 2024 19:01:58 +0200
An of_node_put(canvas_node) call was immediately used after a pointer check
for a of_find_device_by_node() call in this function implementation.
Thus call such a function only once instead directly before the check.
This issue was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/soc/amlogic/meson-canvas.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/soc/amlogic/meson-canvas.c b/drivers/soc/amlogic/meson-canvas.c
index b6e06c4d2117..245157053ed3 100644
--- a/drivers/soc/amlogic/meson-canvas.c
+++ b/drivers/soc/amlogic/meson-canvas.c
@@ -60,12 +60,9 @@ struct meson_canvas *meson_canvas_get(struct device *dev)
return ERR_PTR(-ENODEV);
canvas_pdev = of_find_device_by_node(canvas_node);
- if (!canvas_pdev) {
- of_node_put(canvas_node);
- return ERR_PTR(-EPROBE_DEFER);
- }
-
of_node_put(canvas_node);
+ if (!canvas_pdev)
+ return ERR_PTR(-EPROBE_DEFER);
/*
* If priv is NULL, it's probably because the canvas hasn't
--
2.46.1
Powered by blists - more mailing lists