[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a20a940a-2d81-465a-8c26-9a7f09a5d477@linaro.org>
Date: Tue, 27 Aug 2024 13:12:27 +0200
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Ulf Hansson <ulf.hansson@...aro.org>, Heiko Stuebner <heiko@...ech.de>,
Shawn Guo <shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>, Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>, linux-pm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-rockchip@...ts.infradead.org,
linux-kernel@...r.kernel.org, imx@...ts.linux.dev,
linux-arm-msm@...r.kernel.org, linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH 09/10] pmdomain: renesas: rcar-gen4-sysc: Use scoped
device node handling to simplify error paths
On 27/08/2024 12:55, Geert Uytterhoeven wrote:
>
> So it's perfectly fine to have:
>
> static int __init rcar_gen4_sysc_pd_init(void)
> {
> struct device_node *np __free(device_node) = NULL;
> struct rcar_gen4_pm_domains *domains;
> const struct rcar_gen4_sysc_info *info;
> const struct of_device_id *match;
> void __iomem *base;
> unsigned int i;
> int error;
>
> np = of_find_matching_node_and_match(NULL,
> rcar_gen4_sysc_matches, &match);
> if (!np)
> return -ENODEV;
>
> ...
> }
It is not perfectly fine because it does not match the preference of
having declaration with the constructor. See responses from Linus.
>
> But my first suggestion:
>
> static int __init rcar_gen4_sysc_pd_init(void)
> {
> struct device_node *np __free(device_node) =
> of_find_matching_node_and_match(NULL,
> rcar_gen4_sysc_matches, &match);
> struct rcar_gen4_pm_domains *domains;
> const struct rcar_gen4_sysc_info *info;
> const struct of_device_id *match;
> void __iomem *base;
> unsigned int i;
> int error;
>
> if (!np)
> return -ENODEV;
>
> ...
> }
>
> is safer w.r.t. to future modification.
Indeed, sure, I will re-write it above.
Best regards,
Krzysztof
Powered by blists - more mailing lists