public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ssb: use "break" on default case to prevent warning
@ 2024-03-13  0:13 Randy Dunlap
  2024-03-13  6:57 ` Michael Büsch
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Randy Dunlap @ 2024-03-13  0:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, kernel test robot, Michael Büsch,
	linux-wireless, Kalle Valo, Johannes Berg, llvm

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 <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202403130717.TWm17FiD-lkp@intel.com/
Cc: Michael Büsch <m@bues.ch>
Cc: linux-wireless@vger.kernel.org
Cc: Kalle Valo <kvalo@kernel.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: llvm@lists.linux.dev
---
 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;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ssb: use "break" on default case to prevent warning
  2024-03-13  0:13 [PATCH] ssb: use "break" on default case to prevent warning Randy Dunlap
@ 2024-03-13  6:57 ` Michael Büsch
  2024-03-13 15:32 ` Nathan Chancellor
  2024-03-14  8:56 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Büsch @ 2024-03-13  6:57 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-kernel, kernel test robot, linux-wireless, Kalle Valo,
	Johannes Berg, llvm

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

On Tue, 12 Mar 2024 17:13:03 -0700
Randy Dunlap <rdunlap@infradead.org> 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 <m@bues.ch>


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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ssb: use "break" on default case to prevent warning
  2024-03-13  0:13 [PATCH] ssb: use "break" on default case to prevent warning Randy Dunlap
  2024-03-13  6:57 ` Michael Büsch
@ 2024-03-13 15:32 ` Nathan Chancellor
  2024-03-14  8:56 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2024-03-13 15:32 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-kernel, kernel test robot, Michael Büsch,
	linux-wireless, Kalle Valo, Johannes Berg, llvm

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 <rdunlap@infradead.org>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202403130717.TWm17FiD-lkp@intel.com/
> Cc: Michael Büsch <m@bues.ch>
> Cc: linux-wireless@vger.kernel.org
> Cc: Kalle Valo <kvalo@kernel.org>
> Cc: Johannes Berg <johannes@sipsolutions.net>
> Cc: llvm@lists.linux.dev

Thanks for the quick fix!

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ssb: use "break" on default case to prevent warning
  2024-03-13  0:13 [PATCH] ssb: use "break" on default case to prevent warning Randy Dunlap
  2024-03-13  6:57 ` Michael Büsch
  2024-03-13 15:32 ` Nathan Chancellor
@ 2024-03-14  8:56 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2024-03-14  8:56 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-kernel, Randy Dunlap, kernel test robot, Michael Büsch,
	linux-wireless, Johannes Berg, llvm

Randy Dunlap <rdunlap@infradead.org> 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 <rdunlap@infradead.org>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202403130717.TWm17FiD-lkp@intel.com/
> Cc: Michael Büsch <m@bues.ch>
> Cc: linux-wireless@vger.kernel.org
> Cc: Kalle Valo <kvalo@kernel.org>
> Cc: Johannes Berg <johannes@sipsolutions.net>
> Cc: llvm@lists.linux.dev
> Acked-by: Michael Büsch <m@bues.ch>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>

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/20240313001305.18820-1-rdunlap@infradead.org/

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-14  8:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-13  0:13 [PATCH] ssb: use "break" on default case to prevent warning Randy Dunlap
2024-03-13  6:57 ` Michael Büsch
2024-03-13 15:32 ` Nathan Chancellor
2024-03-14  8:56 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox