[PATCH 08/21] pinctrl: samsung: Use scope based of_node_put() cleanups

Krzysztof Kozlowski krzk at kernel.org
Thu May 2 02:35:11 AEST 2024


On 01/05/2024 14:56, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan at nxp.com>
> 
> Use scope based of_node_put() cleanup to simplify code.
> 
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> ---
>  drivers/pinctrl/samsung/pinctrl-exynos-arm.c |  3 +--
>  drivers/pinctrl/samsung/pinctrl-exynos.c     | 16 ++++------------
>  drivers/pinctrl/samsung/pinctrl-s3c64xx.c    |  8 ++------
>  drivers/pinctrl/samsung/pinctrl-samsung.c    | 26 +++++++-------------------
>  4 files changed, 14 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c
> index 85ddf49a5188..9a57b3ceb536 100644
> --- a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c
> +++ b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c
> @@ -56,7 +56,7 @@ s5pv210_retention_init(struct samsung_pinctrl_drv_data *drvdata,
>  		       const struct samsung_retention_data *data)
>  {
>  	struct samsung_retention_ctrl *ctrl;
> -	struct device_node *np;
> +	struct device_node *np __free(device_node) = NULL;
>  	void __iomem *clk_base;
>  
>  	ctrl = devm_kzalloc(drvdata->dev, sizeof(*ctrl), GFP_KERNEL);
> @@ -71,7 +71,6 @@ s5pv210_retention_init(struct samsung_pinctrl_drv_data *drvdata,
>  	}
>  
>  	clk_base = of_iomap(np, 0);
> -	of_node_put(np);

I don't think the code as simpler. Previous was very easy to read,
obvious, no error paths.

To me any conversion of such of_node_get immediately followed by
of_node_put is unwelcomed. Easy code is being  converted to complicated one.


Best regards,
Krzysztof



More information about the Linux-aspeed mailing list