[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20140213.142148.477625151411590832.davem@davemloft.net>
Date: Thu, 13 Feb 2014 14:21:48 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: alexei.starovoitov@...il.com
Cc: kda@...ux-powerpc.org, netdev@...r.kernel.org
Subject: Re: [PATCH v2 net-next] net: remove useless if check from
register_netdevice()
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
Date: Thu, 13 Feb 2014 08:23:08 -0800
> On Wed, Feb 12, 2014 at 8:47 PM, Denis Kirjanov <kda@...ux-powerpc.org> wrote:
>> remove useless if check from register_netdevice()
>>
>> Signed-off-by: Denis Kirjanov <kda@...ux-powerpc.org>
>> ---
>> v1 -> v2: Fixed identation
>> ---
>> net/core/dev.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 4ad1b78..21a72ad 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -5876,8 +5876,7 @@ int register_netdevice(struct net_device *dev)
>> if (dev->netdev_ops->ndo_init) {
>> ret = dev->netdev_ops->ndo_init(dev);
>> if (ret) {
>> - if (ret > 0)
>> - ret = -EIO;
>> + ret = -EIO;
>> goto out;
>
> why is it a useless check?
> seems perfectly valid to me.
> most of the time ndo_init() returns negative error code like -ENOMEM
> which we want
> to propagate further down and want to override it to -EIO if it's > 0
Agreed, and if it is useless then unconditionally returining -EIO is
absolutely the wrong thing to do. We should always use whatever negative
error code ndo_init() gave us.
I'm not applying this patch.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists