[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2763f37a-8707-7fad-5dd4-cc4247fe3e1b@huawei.com>
Date: Wed, 23 Aug 2023 15:43:58 +0800
From: Ruan Jinjie <ruanjinjie@...wei.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: <rafal@...ecki.pl>, <bcm-kernel-feedback-list@...adcom.com>,
<davem@...emloft.net>, <edumazet@...gle.com>, <pabeni@...hat.com>,
<opendmb@...il.com>, <florian.fainelli@...adcom.com>,
<bryan.whitehead@...rochip.com>, <UNGLinuxDriver@...rochip.com>,
<netdev@...r.kernel.org>, <andrew@...n.ch>
Subject: Re: [PATCH net-next v4 3/3] net: lan743x: Return PTR_ERR() for
fixed_phy_register()
On 2023/8/23 8:03, Jakub Kicinski wrote:
> On Mon, 21 Aug 2023 10:50:20 +0800 Jinjie Ruan wrote:
>> fixed_phy_register() returns -c, -EINVAL and -EBUSY,
>> etc, in addition to -EIO. The Best practice is to return these
>> error codes with PTR_ERR().
>
> EPROBE_DEFER is not a unix error code. We can't return it to user
> space, so propagating it from ndo_open is not correct.
When the error is EPROBE_DEFER, Whether print the netdev_err is ok? And
what should it return?
How about this?
if (IS_ERR(phydev)) {
......
if (PTR_ERR(phydev) != -EPROBE_DEFER)
return PTR_ERR(phydev);
else
return -EIO;
}
>
>> diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
>> index a36f6369f132..c81cdeb4d4e7 100644
>> --- a/drivers/net/ethernet/microchip/lan743x_main.c
>> +++ b/drivers/net/ethernet/microchip/lan743x_main.c
>> @@ -1515,7 +1515,7 @@ static int lan743x_phy_open(struct lan743x_adapter *adapter)
>> &fphy_status, NULL);
>> if (IS_ERR(phydev)) {
>> netdev_err(netdev, "No PHY/fixed_PHY found\n");
>> - return -EIO;
>> + return PTR_ERR(phydev);
>> }
>> } else {
>> goto return_error;
Powered by blists - more mailing lists