Re: [PATCH 2/4] of: unittest: Use __free(device_node)

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

 



On Sun, Jan 14, 2024 at 10:54 AM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
>
> A simple example of the utility of this autocleanup approach to
> handling of_node_put()
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> ---
>  drivers/of/unittest.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
> index e9e90e96600e..b6d9edb831f0 100644
> --- a/drivers/of/unittest.c
> +++ b/drivers/of/unittest.c
> @@ -233,27 +233,23 @@ static void __init of_unittest_dynamic(void)
>
>  static int __init of_unittest_check_node_linkage(struct device_node *np)
>  {
> -       struct device_node *child;
> +       struct device_node *child __free(device_node) = NULL;

In another thread[1], it seems that initializing to NULL is bad form
according to the chief penguin. But as this is a refcounted pointer
rather than an allocation, IDK?

Rob

[1] https://lore.kernel.org/all/289c4af00bcc46e83555dacbc76f56477126d645.camel@xxxxxxxxxxxxxx





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux