[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f8befc17-bc29-41f0-95f7-7af3f854d77e@lunn.ch>
Date: Mon, 10 Jun 2024 17:42:30 +0200
From: Andrew Lunn <andrew@...n.ch>
To: FUJITA Tomonori <fujita.tomonori@...il.com>
Cc: linux@...linux.org.uk, netdev@...r.kernel.org, horms@...nel.org,
kuba@...nel.org, jiri@...nulli.us, pabeni@...hat.com,
hfdevel@....net, naveenm@...vell.com, jdamato@...tly.com
Subject: Re: [PATCH net-next v9 6/6] net: tn40xx: add phylink support
On Mon, Jun 10, 2024 at 03:10:23PM +0900, FUJITA Tomonori wrote:
> Hi,
>
> On Sun, 9 Jun 2024 11:34:28 +0100
> "Russell King (Oracle)" <linux@...linux.org.uk> wrote:
>
> >> +int tn40_phy_register(struct tn40_priv *priv)
> >> +{
> >> + struct phylink_config *config;
> >> + struct phy_device *phydev;
> >> + struct phylink *phylink;
> >> +
> >> + phydev = phy_find_first(priv->mdio);
> >> + if (!phydev) {
> >> + dev_err(&priv->pdev->dev, "PHY isn't found\n");
> >> + return -1;
> >
> > And my email client, setup with rules to catch common programming
> > mistakes, highlights the above line. I have no idea why people do
> > this... why people think "lets return -1 on error". It seems to be
> > a very common pattern... but it's utterly wrong. -1 is -EPERM, aka
> > "Operation not permitted". This is not what you mean here. Please
> > return a more suitable negative errno symbol... and please refrain
> > from using "return -1" in kernel code.
>
> Indeed, my bad. How about -ENODEV? Or -ENOXIO?
ENODEV.
Andrew
Powered by blists - more mailing lists