Re: [PATCH 09/10] pmdomain: renesas: rcar-gen4-sysc: Use scoped device node handling to simplify error paths

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

 



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





[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