* [PATCH][mtd-next] mtd: spi-nor: remove redundant check on err
@ 2017-06-29 17:50 Colin King
2017-08-01 16:33 ` Cyrille Pitchen
0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2017-06-29 17:50 UTC (permalink / raw)
To: Cyrille Pitchen, Marek Vasut, David Woodhouse, Brian Norris,
Boris Brezillon, Richard Weinberger, linux-mtd
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The variable err is not updated since the previous check on it, so
the subsequent check on err is redundant and can be removed.
Detected by CoverityScan, CID#1448658 ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/mtd/spi-nor/spi-nor.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 196b52f083ae..1296c1931591 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -2307,9 +2307,6 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor,
default:
break;
}
-
- if (err)
- goto exit;
}
exit:
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][mtd-next] mtd: spi-nor: remove redundant check on err
2017-06-29 17:50 [PATCH][mtd-next] mtd: spi-nor: remove redundant check on err Colin King
@ 2017-08-01 16:33 ` Cyrille Pitchen
2017-08-01 17:00 ` walter harms
0 siblings, 1 reply; 3+ messages in thread
From: Cyrille Pitchen @ 2017-08-01 16:33 UTC (permalink / raw)
To: Colin King, Marek Vasut, David Woodhouse, Brian Norris,
Boris Brezillon, Richard Weinberger, linux-mtd
Cc: kernel-janitors, linux-kernel
Hi Colin,
Le 29/06/2017 à 19:50, Colin King a écrit :
> From: Colin Ian King <colin.king@canonical.com>
>
> The variable err is not updated since the previous check on it, so
> the subsequent check on err is redundant and can be removed.
>
> Detected by CoverityScan, CID#1448658 ("Logically dead code")
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/mtd/spi-nor/spi-nor.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index 196b52f083ae..1296c1931591 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -2307,9 +2307,6 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor,
> default:
> break;
> }
> -
> - if (err)
> - goto exit;
Sorry but this was done on purpose to prepare the structure of the
source code so it's more easy to add later parsing of optional SFDP
tables such as the 4-byte address instruction set table or sector erase
map table.
At that time each case of the switch statement should update the value
of 'err'.
Best regards,
Cyrille
> }
>
> exit:
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][mtd-next] mtd: spi-nor: remove redundant check on err
2017-08-01 16:33 ` Cyrille Pitchen
@ 2017-08-01 17:00 ` walter harms
0 siblings, 0 replies; 3+ messages in thread
From: walter harms @ 2017-08-01 17:00 UTC (permalink / raw)
To: Cyrille Pitchen
Cc: Colin King, Marek Vasut, David Woodhouse, Brian Norris,
Boris Brezillon, Richard Weinberger, linux-mtd, kernel-janitors,
linux-kernel
Am 01.08.2017 18:33, schrieb Cyrille Pitchen:
> Hi Colin,
>
> Le 29/06/2017 à 19:50, Colin King a écrit :
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The variable err is not updated since the previous check on it, so
>> the subsequent check on err is redundant and can be removed.
>>
>> Detected by CoverityScan, CID#1448658 ("Logically dead code")
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>> drivers/mtd/spi-nor/spi-nor.c | 3 ---
>> 1 file changed, 3 deletions(-)
>>
>> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
>> index 196b52f083ae..1296c1931591 100644
>> --- a/drivers/mtd/spi-nor/spi-nor.c
>> +++ b/drivers/mtd/spi-nor/spi-nor.c
>> @@ -2307,9 +2307,6 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor,
>> default:
>> break;
>> }
>> -
>> - if (err)
>> - goto exit;
>
> Sorry but this was done on purpose to prepare the structure of the
> source code so it's more easy to add later parsing of optional SFDP
> tables such as the 4-byte address instruction set table or sector erase
> map table.
> At that time each case of the switch statement should update the value
> of 'err'.
>
> Best regards,
>
This is hard to guess, could you add a comment so the next well meaning person
has a chance to know that this is onn purpose ?
re,
wh
> Cyrille
>> }
>>
>> exit:
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-01 17:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29 17:50 [PATCH][mtd-next] mtd: spi-nor: remove redundant check on err Colin King
2017-08-01 16:33 ` Cyrille Pitchen
2017-08-01 17:00 ` walter harms
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).