From: Markus Elfring <Markus.Elfring@web.de>
To: linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
Angelo Gioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Kevin Hilman <khilman@baylibre.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Roger Lu <roger.lu@mediatek.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Subject: [PATCH] soc: mediatek: mtk-svs: Call of_node_put(np) only once in svs_get_subsys_device()
Date: Tue, 24 Sep 2024 20:08:15 +0200 [thread overview]
Message-ID: <884f0a5d-e6d3-47dc-8a9e-201bb86b271f@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 24 Sep 2024 20:00:09 +0200
An of_node_put(np) 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@users.sourceforge.net>
---
drivers/soc/mediatek/mtk-svs.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/soc/mediatek/mtk-svs.c b/drivers/soc/mediatek/mtk-svs.c
index 9a91298c1253..7c349a94b45c 100644
--- a/drivers/soc/mediatek/mtk-svs.c
+++ b/drivers/soc/mediatek/mtk-svs.c
@@ -2133,14 +2133,12 @@ static struct device *svs_get_subsys_device(struct svs_platform *svsp,
}
pdev = of_find_device_by_node(np);
+ of_node_put(np);
if (!pdev) {
- of_node_put(np);
dev_err(svsp->dev, "cannot find pdev by %s\n", node_name);
return ERR_PTR(-ENXIO);
}
- of_node_put(np);
-
return &pdev->dev;
}
--
2.46.1
next reply other threads:[~2024-09-24 18:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-24 18:08 Markus Elfring [this message]
2024-09-25 7:46 ` [PATCH] soc: mediatek: mtk-svs: Call of_node_put(np) only once in svs_get_subsys_device() AngeloGioacchino Del Regno
2024-10-02 9:08 ` AngeloGioacchino Del Regno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=884f0a5d-e6d3-47dc-8a9e-201bb86b271f@web.de \
--to=markus.elfring@web.de \
--cc=angelogioacchino.delregno@collabora.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=khilman@baylibre.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=roger.lu@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox