Re: [net-next PATCH v3 5/5] net: mdiobus: Introduce fwnode_mdiobus_register_phy()

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

 



On Tue, May 05, 2020 at 05:22:00PM +0300, Andy Shevchenko wrote:
> On Tue, May 5, 2020 at 4:30 PM Calvin Johnson
> <calvin.johnson@xxxxxxxxxxx> wrote:
> >
> > Introduce fwnode_mdiobus_register_phy() to register PHYs on the
> > mdiobus. From the compatible string, identify whether the PHY is
> > c45 and based on this create a PHY device instance which is
> > registered on the mdiobus.
> 
> ...
> 
> > +int fwnode_mdiobus_register_phy(struct mii_bus *bus,
> > +                               struct fwnode_handle *child, u32 addr)
> > +{
> > +       struct phy_device *phy;
> 
> > +       bool is_c45 = false;
> 
> Redundant assignment, see below.
> 
> > +       const char *cp;
> > +       u32 phy_id;
> > +       int rc;
> > +
> 
> > +       fwnode_property_read_string(child, "compatible", &cp);
> 
> Consider rc = ...; otherwise you will have UB below.
> 
> > +       if (!strcmp(cp, "ethernet-phy-ieee802.3-c45"))
> 
> UB!

Thanks for the comments! I've considered all of them.
What is UB, by the way? :)-

Regards
Calvin



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux