[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <32e9ec0e-5ba6-4653-adf7-ccd0af7d58a9@collabora.com>
Date: Wed, 25 Sep 2024 09:46:35 +0200
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
To: Markus Elfring <Markus.Elfring@....de>,
linux-mediatek@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org,
Kevin Hilman <khilman@...libre.com>,
Matthias Brugger <matthias.bgg@...il.com>, Roger Lu <roger.lu@...iatek.com>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Subject: Re: [PATCH] soc: mediatek: mtk-svs: Call of_node_put(np) only once in
svs_get_subsys_device()
Il 24/09/24 20:08, Markus Elfring ha scritto:
> From: Markus Elfring <elfring@...rs.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@...rs.sourceforge.net>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
> ---
> 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
>
Powered by blists - more mailing lists