Re: [PATCHv4 net] net: asix: fix modprobe "sysfs: cannot create duplicate filename"

From: Grant Grundler
Date: Fri Mar 17 2023 - 13:59:16 EST


On Wed, Mar 15, 2023 at 10:08 PM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
>
> On Mon, 13 Mar 2023 22:54:10 -0700 Grant Grundler wrote:
> > @@ -690,6 +704,7 @@ static int ax88772_init_phy(struct usbnet *dev)
> > priv->phydev = mdiobus_get_phy(priv->mdio, priv->phy_addr);
> > if (!priv->phydev) {
> > netdev_err(dev->net, "Could not find PHY\n");
> > + ax88772_mdio_unregister(priv);
>
> this line needs to go now..
>
> > return -ENODEV;
>
> .. since if we return error here ..
>
> > }
> >
> > @@ -896,16 +911,23 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
> >
> > ret = ax88772_init_mdio(dev);
> > if (ret)
> > - return ret;
> > + goto mdio_err;
> >
> > ret = ax88772_phylink_setup(dev);
> > if (ret)
> > - return ret;
> > + goto phylink_err;
> >
> > ret = ax88772_init_phy(dev);
>
> .. it will pop out here ..
>
> > if (ret)
> > - phylink_destroy(priv->phylink);
> > + goto initphy_err;
> >
> > + return 0;
> > +
> > +initphy_err:
> > + phylink_destroy(priv->phylink);
> > +phylink_err:
> > + ax88772_mdio_unregister(priv);
>
> .. and then call ax88772_mdio_unregister() a second time.

Doh! Yes - good catch. Let me fix that.

cheers,
grant

>
> > +mdio_err:
> > return ret;
> > }