[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHPKR9KeEcfgD2ZJOJFzEEMKdXH2Kqtc_O4k9Ot5XrB60T+60A@mail.gmail.com>
Date: Wed, 19 Mar 2014 10:23:16 +0530
From: Balakumaran Kannan <kumaran.4353@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: David Laight <David.Laight@...lab.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH] net : Remove unnecessary assignments
Thanks David and Joe for clarifications
Regards,
K.Balakumaran
On Tue, Mar 18, 2014 at 10:33 PM, Joe Perches <joe@...ches.com> wrote:
> On Tue, 2014-03-18 at 16:22 +0000, David Laight wrote:
>> From: Behalf Of Balakumaran Kannan
>> > Remove unnecessary assignments
>> >
>> > Signed-off-by: Balakumaran Kannan <kumaran.4353@...il.com>
>> > ---
>> > Some unnecessary assignments has been removed from devinet_ioctl function.
>> > The 'ret' variable is set in multiple places, but used only based on if
>> > conditions. So keeping the assignment inside if will be a better.
>> ...
>>
>> These all seem to be this transform:
>> > - ret = -ENODEV;
>> > dev = __dev_get_by_name(net, ifr.ifr_name);
>> > - if (!dev)
>> > + if (!dev) {
>> > + ret = -ENODEV;
>> > goto done;
>> > + }
>>
>> I bet that if you look at the generated code you'll find
>> that the compiler generates the same code for both forms
>> and is likely to generate the equivalent of:
>> dev = __dev_get_by_name(net, ifr.ifr_name);
>> ret = -ENODEV;
>> if (!dev)
>> goto done;
>>
>> So this is just a matter of style.
>
> Yabut it's Linus' preferred style.
> http://lkml.org/lkml/2008/12/16/383
>
> (but not mine, I prefer what's done by the 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