lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL_Jsq+obCEeaNjpvJ6VvO6b2F6A5oHcRD8PYAifUvBQHbQ_Og@mail.gmail.com>
Date:   Mon, 4 Nov 2019 09:18:39 -0600
From:   Rob Herring <robh+dt@...nel.org>
To:     Saravana Kannan <saravanak@...gle.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Frank Rowand <frowand.list@...il.com>,
        Len Brown <lenb@...nel.org>,
        Android Kernel Team <kernel-team@...roid.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        devicetree@...r.kernel.org, linux-acpi@...r.kernel.org
Subject: Re: [PATCH v1 5/5] of: property: Skip adding device links to
 suppliers that aren't devices

On Mon, Oct 28, 2019 at 5:00 PM Saravana Kannan <saravanak@...gle.com> wrote:
>
> Some devices need to be initialized really early and can't wait for
> driver core or drivers to be functional.  These devices are typically
> initialized without creating a struct device for their device nodes.
>
> If a supplier ends up being one of these devices, skip trying to add
> device links to them.
>
> Signed-off-by: Saravana Kannan <saravanak@...gle.com>
> ---
>  drivers/of/property.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/of/property.c b/drivers/of/property.c
> index f16f85597ccc..21c9d251318a 100644
> --- a/drivers/of/property.c
> +++ b/drivers/of/property.c
> @@ -1038,6 +1038,7 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np,
>         struct device *sup_dev;
>         int ret = 0;
>         struct device_node *tmp_np = sup_np;
> +       int is_populated;
>
>         of_node_get(sup_np);
>         /*
> @@ -1062,9 +1063,10 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np,
>                 return -EINVAL;
>         }
>         sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
> +       is_populated = of_node_check_flag(sup_np, OF_POPULATED);
>         of_node_put(sup_np);
>         if (!sup_dev)
> -               return -EAGAIN;
> +               return is_populated ? 0 : -EAGAIN;

You're only using the flag in one spot and a comment would be good
here, so I'd just do:

if (of_node_check_flag(sup_np, OF_POPULATED))
        return 0; /* Early device without a struct device */

>         if (!device_link_add(dev, sup_dev, dl_flags))
>                 ret = -EAGAIN;
>         put_device(sup_dev);
> --
> 2.24.0.rc0.303.g954a862665-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ