public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: Peter Senna Tschudin <peter.senna@gmail.com>
Cc: dan.carpenter@oracle.com, kernel-janitors@vger.kernel.org,
	kernelnewbies@kernelnewbies.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] Remove useless return variables
Date: Sat, 17 May 2014 22:04:35 -0700	[thread overview]
Message-ID: <87y4xzpti4.fsf@tassilo.jf.intel.com> (raw)
In-Reply-To: <1400379310-10214-1-git-send-email-peter.senna@gmail.com> (Peter Senna Tschudin's message of "Sun, 18 May 2014 04:15:10 +0200")

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.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only

  reply	other threads:[~2014-05-18  5:05 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 [this message]
2014-05-18 10:43   ` Dan Carpenter
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=87y4xzpti4.fsf@tassilo.jf.intel.com \
    --to=andi@firstfloor.org \
    --cc=dan.carpenter@oracle.com \
    --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