[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20201210170723.GD1578121@piout.net>
Date: Thu, 10 Dec 2020 18:07:23 +0100
From: Alexandre Belloni <alexandre.belloni@...tlin.com>
To: Markus Elfring <Markus.Elfring@....de>
Cc: linux-mmc@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Ludovic Desroches <ludovic.desroches@...rochip.com>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Ulf Hansson <ulf.hansson@...aro.org>,
LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] mmc: atmel-mci: Reduce scope for the variable “slot” in
atmci_request_end()
On 10/12/2020 17:35:31+0100, Markus Elfring wrote:
> >> A local variable was used only within an if branch.
> >> Thus move the definition for the variable “slot” into the corresponding
> >> code block.
> >>
> >
> > What is the improvement here?
>
> A possible refactoring.
> https://refactoring.com/catalog/reduceScopeOfVariable.html
>
I quote:
"Since declarations of variables in many cases costs computational
cycles, you may end up wasting time for nothing."
This is false, it doesn't.
I also quote:
"When I'm writing new code I find I don't scope my temps any less than
method scope. This is because I keep my methods short, so reducing scope
any further doesn't add much value. The value of this refactoring is in
breaking up a large method."
Is that function large? It is not.
>
> > This makes the code harder to read.
>
> Can the extra null pointer initialisation trigger a source code analysis warning
> like “Addresses-Coverity: ("Unused value")” for this function implementation?
>
Did you check, does it? It doesn't.
Are you wasting maintainer and reviewer's time? Yes you are.
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists