[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1395162206.2812.56.camel@joe-AO722>
Date: Tue, 18 Mar 2014 10:03:26 -0700
From: Joe Perches <joe@...ches.com>
To: David Laight <David.Laight@...LAB.COM>
Cc: 'Balakumaran Kannan' <kumaran.4353@...il.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"kuznet@....inr.ac.ru" <kuznet@....inr.ac.ru>,
"jmorris@...ei.org" <jmorris@...ei.org>,
"yoshfuji@...ux-ipv6.org" <yoshfuji@...ux-ipv6.org>,
"kaber@...sh.net" <kaber@...sh.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH] net : Remove unnecessary assignments
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