[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140518104314.GK15585@mwanda>
Date: Sun, 18 May 2014 13:43:14 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: Peter Senna Tschudin <peter.senna@...il.com>,
kernel-janitors@...r.kernel.org, kernelnewbies@...nelnewbies.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC] Remove useless return variables
On Sat, May 17, 2014 at 10:04:35PM -0700, Andi Kleen wrote:
> Peter Senna Tschudin <peter.senna@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists