[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210922100429.pjrd2s4y3jbxpjjt@soft-dev3-1.localhost>
Date: Wed, 22 Sep 2021 12:04:29 +0200
From: Horatiu Vultur <horatiu.vultur@...rochip.com>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
CC: <davem@...emloft.net>, <kuba@...nel.org>, <robh+dt@...nel.org>,
<andrew@...n.ch>, <f.fainelli@...il.com>,
<alexandre.belloni@...tlin.com>, <vladimir.oltean@....com>,
<UNGLinuxDriver@...rochip.com>, <netdev@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-phy@...ts.infradead.org>, <linux-pm@...r.kernel.org>
Subject: Re: [RFC PATCH net-next 03/12] phy: Add lan966x ethernet serdes PHY
driver
The 09/20/2021 14:42, Russell King (Oracle) wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On Mon, Sep 20, 2021 at 11:52:09AM +0200, Horatiu Vultur wrote:
> > +static int lan966x_calc_sd6g40_setup_lane(struct lan966x_sd6g40_setup_args config,
> > + struct lan966x_sd6g40_setup *ret_val)
> > +{
> > + struct lan966x_sd6g40_mode_args sd6g40_mode;
> > + struct lan966x_sd6g40_mode_args *mode_args = &sd6g40_mode;
> > +
> > + if (lan966x_sd6g40_get_conf_from_mode(config.mode, config.refclk125M,
> > + mode_args))
> > + return -1;
>
> This needs fixing to be a real negative error number.
> lan966x_sd6g40_setup_lane() propagates this functions non-zero
> return value, which is then propagated through lan966x_sd6g40_setup(),
> and then through serdes_set_mode() to the PHY layer.
>
> In general, I would suggest that _all_ int-returning functions in the
> kernel that return a negative failure value _should_ _always_ return a
> negative error code, so that your reviewers don't have to chase code
> paths to work out whether a mistake such as the above exists.
>
> To put it another way: never use "return -1" in the kernel.
Hi Russell,
Thanks for the suggestion. I will fix this in the next version.
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
--
/Horatiu
Powered by blists - more mailing lists