2024-03-13 00:13:16

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH] ssb: use "break" on default case to prevent warning

Having an empty default: case in a switch statement causes a warning
(when using Clang; I don't see the warning when using gcc),
so add a "break;" to the default case to prevent the warning:

drivers/ssb/main.c:1149:2: warning: label at end of compound statement is a C2x extension [-Wc2x-extensions]

Fixes: e27b02e23a70 ("ssb: drop use of non-existing CONFIG_SSB_DEBUG symbol")
Signed-off-by: Randy Dunlap <[email protected]>
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Cc: Michael Büsch <[email protected]>
Cc: [email protected]
Cc: Kalle Valo <[email protected]>
Cc: Johannes Berg <[email protected]>
Cc: [email protected]
---
drivers/ssb/main.c | 1 +
1 file changed, 1 insertion(+)

diff -- a/drivers/ssb/main.c b/drivers/ssb/main.c
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -1144,6 +1144,7 @@ u32 ssb_dma_translation(struct ssb_devic
return SSB_PCI_DMA;
}
default:
+ break;
}
return 0;
}


2024-03-13 06:58:22

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH] ssb: use "break" on default case to prevent warning

On Tue, 12 Mar 2024 17:13:03 -0700
Randy Dunlap <[email protected]> wrote:
> --- a/drivers/ssb/main.c
> +++ b/drivers/ssb/main.c
> @@ -1144,6 +1144,7 @@ u32 ssb_dma_translation(struct ssb_devic
> return SSB_PCI_DMA;
> }
> default:
> + break;
> }
> return 0;
> }
>

Acked-by: Michael Büsch <[email protected]>


--
Michael Büsch
https://bues.ch/


Attachments:
(No filename) (849.00 B)
OpenPGP digital signature

2024-03-13 15:32:46

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH] ssb: use "break" on default case to prevent warning

On Tue, Mar 12, 2024 at 05:13:03PM -0700, Randy Dunlap wrote:
> Having an empty default: case in a switch statement causes a warning
> (when using Clang; I don't see the warning when using gcc),
> so add a "break;" to the default case to prevent the warning:
>
> drivers/ssb/main.c:1149:2: warning: label at end of compound statement is a C2x extension [-Wc2x-extensions]

It is a hard error with earlier versions of clang as well:

drivers/ssb/main.c:1148:10: error: label at end of compound statement: expected statement
default:
^
;
1 error generated.

> Fixes: e27b02e23a70 ("ssb: drop use of non-existing CONFIG_SSB_DEBUG symbol")
> Signed-off-by: Randy Dunlap <[email protected]>
> Reported-by: kernel test robot <[email protected]>
> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> Cc: Michael B?sch <[email protected]>
> Cc: [email protected]
> Cc: Kalle Valo <[email protected]>
> Cc: Johannes Berg <[email protected]>
> Cc: [email protected]

Thanks for the quick fix!

Reviewed-by: Nathan Chancellor <[email protected]>

> ---
> drivers/ssb/main.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff -- a/drivers/ssb/main.c b/drivers/ssb/main.c
> --- a/drivers/ssb/main.c
> +++ b/drivers/ssb/main.c
> @@ -1144,6 +1144,7 @@ u32 ssb_dma_translation(struct ssb_devic
> return SSB_PCI_DMA;
> }
> default:
> + break;
> }
> return 0;
> }
>

2024-03-14 08:56:42

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] ssb: use "break" on default case to prevent warning

Randy Dunlap <[email protected]> wrote:

> Having an empty default: case in a switch statement causes a warning
> (when using Clang; I don't see the warning when using gcc),
> so add a "break;" to the default case to prevent the warning:
>
> drivers/ssb/main.c:1149:2: warning: label at end of compound statement is a C2x extension [-Wc2x-extensions]
>
> Fixes: e27b02e23a70 ("ssb: drop use of non-existing CONFIG_SSB_DEBUG symbol")
> Signed-off-by: Randy Dunlap <[email protected]>
> Reported-by: kernel test robot <[email protected]>
> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> Cc: Michael Büsch <[email protected]>
> Cc: [email protected]
> Cc: Kalle Valo <[email protected]>
> Cc: Johannes Berg <[email protected]>
> Cc: [email protected]
> Acked-by: Michael Büsch <[email protected]>
> Reviewed-by: Nathan Chancellor <[email protected]>

Patch applied to wireless-next.git, thanks.

6c700b35a534 ssb: use "break" on default case to prevent warning

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches