Re: [PATCH] mmc: atmel-mci: Reduce scope for the variable “slot” in atmci_request_end()

Markus Elfring Markus.Elfring at web.de
Thu Dec 10 11:35:31 EST 2020


>> 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


> 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?

Regards,
Markus



More information about the linux-arm-kernel mailing list