From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Peter Senna Tschudin <peter.senna@gmail.com>,
kernel-janitors@vger.kernel.org, kernelnewbies@kernelnewbies.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] Remove useless return variables
Date: Sun, 18 May 2014 13:43:14 +0300 [thread overview]
Message-ID: <20140518104314.GK15585@mwanda> (raw)
In-Reply-To: <87y4xzpti4.fsf@tassilo.jf.intel.com>
On Sat, May 17, 2014 at 10:04:35PM -0700, Andi Kleen wrote:
> Peter Senna Tschudin <peter.senna@gmail.com> writes:
>
> > This patch remove variables that are initialized with a constant,
> > are never updated, and are only used as parameter of return.
> > Return the constant instead of using a variable.
>
> This ret variable pattern is pretty standard in Linux, as it makes it
> easier to add new code that may trigger new errors
> (using the usual "goto forest" error handling pattern)
>
> I don't see any benefit in whole-sale removing it. The compiler
> doesn't care about it and will generate the same code in any
> case.
Peter is not selling this in the right way, it's not about saving
memory. The patch is good because:
return IRQ_HANDLED;
is clearer to read than:
return ret;
And then when you remove the one user, you may as well remove the unused
variable. You could leave it there for future work but really it's not
hard to add it back if it's needed.
regards,
dan carpenter
next prev parent reply other threads:[~2014-05-18 10:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-18 2:15 [PATCH RFC] Remove useless return variables Peter Senna Tschudin
2014-05-18 5:04 ` Andi Kleen
2014-05-18 10:43 ` Dan Carpenter [this message]
2014-05-18 12:14 ` Peter Senna Tschudin
2014-05-23 9:47 ` Jeff Kirsher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140518104314.GK15585@mwanda \
--to=dan.carpenter@oracle.com \
--cc=andi@firstfloor.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kernelnewbies@kernelnewbies.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.senna@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox