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] [day] [month] [year] [list]
Message-ID: <CAHp75Vef0wTJj775PFwXs3XhbXqZBmOQ_E9qdHFYPPCegW4rfA@mail.gmail.com>
Date:   Sat, 11 Jul 2020 00:01:20 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Calvin Johnson <calvin.johnson@....nxp.com>
Cc:     Jeremy Linton <jeremy.linton@....com>,
        Russell King - ARM Linux admin <linux@...linux.org.uk>,
        Jon <jon@...id-run.com>,
        Cristi Sovaiala <cristian.sovaiala@....com>,
        Ioana Ciornei <ioana.ciornei@....com>,
        Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        Madalin Bucur <madalin.bucur@....nxp.com>,
        netdev <netdev@...r.kernel.org>, linux.cj@...il.com,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>
Subject: Re: [net-next PATCH v5 5/6] phylink: introduce phylink_fwnode_phy_connect()

On Fri, Jul 10, 2020 at 7:32 PM Calvin Johnson
<calvin.johnson@....nxp.com> wrote:
>
> Define phylink_fwnode_phy_connect() to connect phy specified by
> a fwnode to a phylink instance.

...

> +int phylink_fwnode_phy_connect(struct phylink *pl,
> +                              struct fwnode_handle *fwnode,
> +                              u32 flags)
> +{
> +       struct phy_device *phy_dev;

> +       int ret = 0;

This assignment is redundant and actually entire var is not needed.

> +       if (is_of_node(fwnode)) {
> +               ret = phylink_of_phy_connect(pl, to_of_node(fwnode), flags);
> +       } else if (is_acpi_device_node(fwnode)) {
> +               phy_dev = phy_find_by_mdio_handle(fwnode);
> +               if (!phy_dev)
> +                       return -ENODEV;
> +               ret = phylink_connect_phy(pl, phy_dev);
> +       } else {
> +               ret = -EINVAL;
> +       }
> +
> +       return ret;

You may refactor in the similar way, i.e.

if (is_of_node(...))
  return phy...
if (is_acpi_device_node(...)) {
  ... return phylink_connect_phy();
}
return -EINVAL;

> +}

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ