Re: [PATCH v2] mtd: spi-nor: Refactor spi_nor_read_id()

From: Tudor.Ambarus
Date: Mon Mar 02 2020 - 13:41:48 EST


On Sunday, February 23, 2020 7:37:13 PM EET Jonathan Neuschäfer wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the
> content is safe
>
> - Don't use `tmp` for two purposes (return value, loop counter).
> Instead, use `i` for the loop counter, and `ret` for the return value.
> - Don't use tabs between type and name in variable declarations,
> for consistency with other functions in spi-nor.c.
> - Rewrite nested `if`s as `if (a && b)`.
> - Remove `info` variable, and use spi_nor_ids[i] directly.
>
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@xxxxxxx>
> ---
>
> v2:
> - As suggested by Tudor Ambarus:
> - rename tmp to ret
> - remove tabs between variable type and name
> - remove `info` variable
>
> v1:
> - https://lore.kernel.org/lkml/20200218151034.24744-1-j.neuschaefer@xxxxxxx/
> ---
> drivers/mtd/spi-nor/spi-nor.c | 25 +++++++++++--------------
> 1 file changed, 11 insertions(+), 14 deletions(-)
>

Changed i's type from int to unsigned int, reordered local variables and
applied to spi-nor/next. Thanks,
ta