diff mbox series

[104/141] mtd: rawnand: stm32_fmc2: Fix fall-through warnings for Clang

Message ID 299d044a69b59eff2c733543b927aa608282a9a8.1605896060.git.gustavoars@kernel.org (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Gustavo A. R. Silva Nov. 20, 2020, 6:37 p.m. UTC
In preparation to enable -Wimplicit-fallthrough for Clang, fix a couple
of warnings by explicitly adding a couple of fallthrough pseudo-keywords
instead of letting the code fall through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/mtd/nand/raw/stm32_fmc2_nand.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Miquel Raynal Nov. 23, 2020, 8:33 a.m. UTC | #1
Hi Gustavo,

"Gustavo A. R. Silva" <gustavoars@kernel.org> wrote on Fri, 20 Nov 2020
12:37:48 -0600:

> In preparation to enable -Wimplicit-fallthrough for Clang, fix a couple
> of warnings by explicitly adding a couple of fallthrough pseudo-keywords
> instead of letting the code fall through to the next case.
> 
> Link: https://github.com/KSPP/linux/issues/115
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>  drivers/mtd/nand/raw/stm32_fmc2_nand.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
> index 550bda4d1415..002fa521036f 100644
> --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c
> +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
> @@ -531,6 +531,7 @@ static int stm32_fmc2_nfc_ham_correct(struct nand_chip *chip, u8 *dat,
>  		switch (b % 4) {
>  		case 2:
>  			bit_position += shifting;
> +			fallthrough;

In patch 100, 101, 102, 103 you 'break' in this case (when the
statement falls into the empty following statement which itself
breaks). Please make it consistent and use break here, below, and in
patch 132.

LGTM otherwise.

>  		case 1:
>  			break;
>  		default:
> @@ -546,6 +547,7 @@ static int stm32_fmc2_nfc_ham_correct(struct nand_chip *chip, u8 *dat,
>  		switch (b % 4) {
>  		case 2:
>  			byte_addr += shifting;
> +			fallthrough;
>  		case 1:
>  			break;
>  		default:

Thanks,
Miquèl
Gustavo A. R. Silva Feb. 8, 2021, 3:15 p.m. UTC | #2
Hi Miquel,

On 11/23/20 02:33, Miquel Raynal wrote:
> Hi Gustavo,
> 
> "Gustavo A. R. Silva" <gustavoars@kernel.org> wrote on Fri, 20 Nov 2020
> 12:37:48 -0600:
> 
>> In preparation to enable -Wimplicit-fallthrough for Clang, fix a couple
>> of warnings by explicitly adding a couple of fallthrough pseudo-keywords
>> instead of letting the code fall through to the next case.
>>
>> Link: https://github.com/KSPP/linux/issues/115
>> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
>> ---
>>  drivers/mtd/nand/raw/stm32_fmc2_nand.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
>> index 550bda4d1415..002fa521036f 100644
>> --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c
>> +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
>> @@ -531,6 +531,7 @@ static int stm32_fmc2_nfc_ham_correct(struct nand_chip *chip, u8 *dat,
>>  		switch (b % 4) {
>>  		case 2:
>>  			bit_position += shifting;
>> +			fallthrough;
> 
> In patch 100, 101, 102, 103 you 'break' in this case (when the
> statement falls into the empty following statement which itself
> breaks). Please make it consistent and use break here, below, and in
> patch 132.

I'll address this and send separate patches.

> LGTM otherwise.

Thanks!
--
Gustavo
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
index 550bda4d1415..002fa521036f 100644
--- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c
+++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
@@ -531,6 +531,7 @@  static int stm32_fmc2_nfc_ham_correct(struct nand_chip *chip, u8 *dat,
 		switch (b % 4) {
 		case 2:
 			bit_position += shifting;
+			fallthrough;
 		case 1:
 			break;
 		default:
@@ -546,6 +547,7 @@  static int stm32_fmc2_nfc_ham_correct(struct nand_chip *chip, u8 *dat,
 		switch (b % 4) {
 		case 2:
 			byte_addr += shifting;
+			fallthrough;
 		case 1:
 			break;
 		default: