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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/05/2024 14:56, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@xxxxxxx>
> 
> Use scope based of_node_put() cleanup to simplify code.
> 
> Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
> ---
>  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





[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux