[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z351FwJ7WiimdUbQ@shell.armlinux.org.uk>
Date: Wed, 8 Jan 2025 12:52:39 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Woojung Huh <woojung.huh@...rochip.com>,
Andrew Lunn <andrew+netdev@...n.ch>, kernel@...gutronix.de,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
UNGLinuxDriver@...rochip.com, Phil Elwell <phil@...pberrypi.org>
Subject: Re: [PATCH net-next v1 3/7] net: usb: lan78xx: Improve error
handling for PHY init path
On Wed, Jan 08, 2025 at 01:13:37PM +0100, Oleksij Rempel wrote:
> phydev = phy_find_first(dev->mdiobus);
> if (!phydev) {
> netdev_dbg(dev->net, "PHY Not Found!! Registering Fixed PHY\n");
> phydev = fixed_phy_register(PHY_POLL, &fphy_status, NULL);
> - if (IS_ERR(phydev)) {
> + if (PTR_ERR_OR_ZERO(phydev)) {
Even though I've said to use phylink's fixed-phy support, I'm wondering
about this entire hunk.
> netdev_err(dev->net, "No PHY/fixed_PHY found\n");
> - return NULL;
> + if (IS_ERR(phydev))
> + return phydev;
> + else
> + return ERR_PTR(-ENODEV);
When does fixed_phy_register() return NULL?
If there's no fixed-phy support enabled, then you get an ENODEV error
pointer. If support is enabled, then you may get an error pointer
or a valid phy_device structure. I can't see any case where it returns
NULL. So, I think this hunk is redundant.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists