netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Rengarajan.S@microchip.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net,
	Thangaraj.S@microchip.com, Woojung.Huh@microchip.com,
	pabeni@redhat.com, o.rempel@pengutronix.de, edumazet@google.com,
	kuba@kernel.org, phil@raspberrypi.org, kernel@pengutronix.de,
	horms@kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, UNGLinuxDriver@microchip.com,
	maxime.chevallier@bootlin.com
Subject: Re: [PATCH net-next v5 2/6] net: usb: lan78xx: Convert to PHYlink for improved PHY and MAC management
Date: Tue, 25 Mar 2025 18:26:50 +0000	[thread overview]
Message-ID: <Z-L1ap2HNc7apxHd@shell.armlinux.org.uk> (raw)
In-Reply-To: <5de15da31f71e1bed8782375b402bcb5df2eb63a.camel@microchip.com>

On Tue, Mar 25, 2025 at 05:37:53PM +0000, Rengarajan.S@microchip.com wrote:
> Hi Oleksji,
> 
> On Wed, 2025-03-19 at 09:49 +0100, Oleksij Rempel wrote:
> >         udev = interface_to_usbdev(intf);
> >         net = dev->net;
> > 
> > +       rtnl_lock();
> > +       phylink_stop(dev->phylink);
> > +       phylink_disconnect_phy(dev->phylink);
> > +       rtnl_unlock();
> > +
> > +       netif_napi_del(&dev->napi);
> > +
> >         unregister_netdev(net);
> > 
> >         timer_shutdown_sync(&dev->stat_monitor);
> >         set_bit(EVENT_DEV_DISCONNECT, &dev->flags);
> >         cancel_delayed_work_sync(&dev->wq);
> > 
> > -       phydev = net->phydev;
> > -
> > -       phy_disconnect(net->phydev);
> > -
> > -       if (phy_is_pseudo_fixed_link(phydev)) {
> > -               fixed_phy_unregister(phydev);
> > -               phy_device_free(phydev);
> > -       }
> > +       phylink_destroy(dev->phylink);
> 
> Before destroying phylink here is it possible to add a check to make
> sure dev->phylink is allocated properly.

Not necessary.

How would dev->phylink not be "allocated properly" ?

If it isn't "allocated properly" then lan78xx_phylink_setup() will
return an error, which will cause lan78xx_probe() to fail. If the
probe function fails, then the driver won't be bound.

Having additional nonsense checks for things that shouldn't ever
happen is annying and detracts from code readability.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2025-03-25 18:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19  8:49 [PATCH net-next v5 0/6] Convert LAN78xx to PHYLINK Oleksij Rempel
2025-03-19  8:49 ` [PATCH net-next v5 1/6] net: usb: lan78xx: Improve error handling in PHY initialization Oleksij Rempel
2025-03-24 15:31   ` Russell King (Oracle)
2025-03-25 17:46   ` Rengarajan.S
2025-03-25 20:06     ` Andrew Lunn
2025-03-19  8:49 ` [PATCH net-next v5 2/6] net: usb: lan78xx: Convert to PHYlink for improved PHY and MAC management Oleksij Rempel
2025-03-19 10:48   ` Maxime Chevallier
2025-03-19 15:14     ` Russell King (Oracle)
2025-03-24 16:18   ` Russell King (Oracle)
2025-03-25 17:37   ` Rengarajan.S
2025-03-25 18:26     ` Russell King (Oracle) [this message]
2025-03-19  8:49 ` [PATCH net-next v5 3/6] net: usb: lan78xx: Use ethtool_op_get_link to reflect current link status Oleksij Rempel
2025-03-19  8:49 ` [PATCH net-next v5 4/6] net: usb: lan78xx: port link settings to phylink API Oleksij Rempel
2025-03-19  8:49 ` [PATCH net-next v5 5/6] net: usb: lan78xx: Integrate EEE support with phylink LPI API Oleksij Rempel
2025-03-25 17:51   ` Rengarajan.S
2025-03-25 18:34     ` Russell King (Oracle)
2025-03-19  8:49 ` [PATCH net-next v5 6/6] net: usb: lan78xx: remove unused struct members Oleksij Rempel
2025-03-24 16:20   ` Russell King (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z-L1ap2HNc7apxHd@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=Rengarajan.S@microchip.com \
    --cc=Thangaraj.S@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=phil@raspberrypi.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).