diff mbox series

irqchip: gic-v3: Mark expected switch fall-through

Message ID 20190726112826.19825-1-anders.roxell@linaro.org
State Accepted
Commit 52f8c8b32ea2f2044efcb4214c1857e29f421c5d
Headers show
Series irqchip: gic-v3: Mark expected switch fall-through | expand

Commit Message

Anders Roxell July 26, 2019, 11:28 a.m. UTC
When fall-through warnings was enabled by default the following warning
was starting to show up:

In file included from ../arch/arm64/include/asm/cputype.h:132,
                 from ../arch/arm64/include/asm/cache.h:8,
                 from ../include/linux/cache.h:6,
                 from ../include/linux/printk.h:9,
                 from ../include/linux/kernel.h:15,
                 from ../include/linux/list.h:9,
                 from ../include/linux/kobject.h:19,
                 from ../include/linux/of.h:17,
                 from ../include/linux/irqdomain.h:35,
                 from ../include/linux/acpi.h:13,
                 from ../drivers/irqchip/irq-gic-v3.c:9:
../drivers/irqchip/irq-gic-v3.c: In function ‘gic_cpu_sys_reg_init’:
../arch/arm64/include/asm/sysreg.h:853:2: warning: this statement may fall
 through [-Wimplicit-fallthrough=]
  asm volatile(__msr_s(r, "%x0") : : "rZ" (__val));  \
  ^~~
../arch/arm64/include/asm/arch_gicv3.h:20:29: note: in expansion of macro ‘write_sysreg_s’
 #define write_gicreg(v, r)  write_sysreg_s(v, SYS_ ## r)
                             ^~~~~~~~~~~~~~
../drivers/irqchip/irq-gic-v3.c:773:4: note: in expansion of macro ‘write_gicreg’
    write_gicreg(0, ICC_AP0R2_EL1);
    ^~~~~~~~~~~~
../drivers/irqchip/irq-gic-v3.c:774:3: note: here
   case 6:
   ^~~~

Rework so that the compiler doesn't warn about fall-through.

Fixes: d93512ef0f0e ("Makefile: Globally enable fall-through warning")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

---
 drivers/irqchip/irq-gic-v3.c | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.20.1

Comments

Marc Zyngier July 26, 2019, 1:17 p.m. UTC | #1
On Fri, 26 Jul 2019 12:28:26 +0100,
Anders Roxell <anders.roxell@linaro.org> wrote:
> 

> When fall-through warnings was enabled by default the following warning

> was starting to show up:

> 

> In file included from ../arch/arm64/include/asm/cputype.h:132,

>                  from ../arch/arm64/include/asm/cache.h:8,

>                  from ../include/linux/cache.h:6,

>                  from ../include/linux/printk.h:9,

>                  from ../include/linux/kernel.h:15,

>                  from ../include/linux/list.h:9,

>                  from ../include/linux/kobject.h:19,

>                  from ../include/linux/of.h:17,

>                  from ../include/linux/irqdomain.h:35,

>                  from ../include/linux/acpi.h:13,

>                  from ../drivers/irqchip/irq-gic-v3.c:9:

> ../drivers/irqchip/irq-gic-v3.c: In function ‘gic_cpu_sys_reg_init’:

> ../arch/arm64/include/asm/sysreg.h:853:2: warning: this statement may fall

>  through [-Wimplicit-fallthrough=]

>   asm volatile(__msr_s(r, "%x0") : : "rZ" (__val));  \

>   ^~~

> ../arch/arm64/include/asm/arch_gicv3.h:20:29: note: in expansion of macro ‘write_sysreg_s’

>  #define write_gicreg(v, r)  write_sysreg_s(v, SYS_ ## r)

>                              ^~~~~~~~~~~~~~

> ../drivers/irqchip/irq-gic-v3.c:773:4: note: in expansion of macro ‘write_gicreg’

>     write_gicreg(0, ICC_AP0R2_EL1);

>     ^~~~~~~~~~~~

> ../drivers/irqchip/irq-gic-v3.c:774:3: note: here

>    case 6:

>    ^~~~

> 

> Rework so that the compiler doesn't warn about fall-through.

> 

> Fixes: d93512ef0f0e ("Makefile: Globally enable fall-through warning")

> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

> ---

>  drivers/irqchip/irq-gic-v3.c | 4 ++++

>  1 file changed, 4 insertions(+)

> 

> diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c

> index 9bca4896fa6f..96d927f0f91a 100644

> --- a/drivers/irqchip/irq-gic-v3.c

> +++ b/drivers/irqchip/irq-gic-v3.c

> @@ -771,8 +771,10 @@ static void gic_cpu_sys_reg_init(void)

>  		case 7:

>  			write_gicreg(0, ICC_AP0R3_EL1);

>  			write_gicreg(0, ICC_AP0R2_EL1);

> +		/* Fall through */

>  		case 6:

>  			write_gicreg(0, ICC_AP0R1_EL1);

> +		/* Fall through */

>  		case 5:

>  		case 4:

>  			write_gicreg(0, ICC_AP0R0_EL1);

> @@ -786,8 +788,10 @@ static void gic_cpu_sys_reg_init(void)

>  	case 7:

>  		write_gicreg(0, ICC_AP1R3_EL1);

>  		write_gicreg(0, ICC_AP1R2_EL1);

> +		/* Fall through */

>  	case 6:

>  		write_gicreg(0, ICC_AP1R1_EL1);

> +		/* Fall through */

>  	case 5:

>  	case 4:

>  		write_gicreg(0, ICC_AP1R0_EL1);

> -- 

> 2.20.1

> 


Applied, thanks.

	M.

-- 
Jazz is not dead, it just smells funny.
diff mbox series

Patch

diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 9bca4896fa6f..96d927f0f91a 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -771,8 +771,10 @@  static void gic_cpu_sys_reg_init(void)
 		case 7:
 			write_gicreg(0, ICC_AP0R3_EL1);
 			write_gicreg(0, ICC_AP0R2_EL1);
+		/* Fall through */
 		case 6:
 			write_gicreg(0, ICC_AP0R1_EL1);
+		/* Fall through */
 		case 5:
 		case 4:
 			write_gicreg(0, ICC_AP0R0_EL1);
@@ -786,8 +788,10 @@  static void gic_cpu_sys_reg_init(void)
 	case 7:
 		write_gicreg(0, ICC_AP1R3_EL1);
 		write_gicreg(0, ICC_AP1R2_EL1);
+		/* Fall through */
 	case 6:
 		write_gicreg(0, ICC_AP1R1_EL1);
+		/* Fall through */
 	case 5:
 	case 4:
 		write_gicreg(0, ICC_AP1R0_EL1);