Skip to contentSkip to conversation

cpufreq: s3c244x: add fallthrough comments for switch

PATCH Applied Arnd Bergmann 3 participants 3 messages Sep 27, 2021 – Oct 4, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: s3c244x: add fallthrough comments for switch

From: Arnd Bergmann <[email protected]>

Apparently nobody has so far caught this warning, I hit it in randconfig build testing:

drivers/cpufreq/s3c2440-cpufreq.c: In function 's3c2440_cpufreq_setdivs':
drivers/cpufreq/s3c2440-cpufreq.c:175:10: error: this statement may fall through [-Werror=implicit-fallthrough=]

   camdiv |= S3C2440_CAMDIVN_HCLK3_HALF;
          ^

drivers/cpufreq/s3c2440-cpufreq.c:176:2: note: here
case 3:
^~~~
drivers/cpufreq/s3c2440-cpufreq.c:181:10: error: this statement may fall through [-Werror=implicit-fallthrough=]

   camdiv |= S3C2440_CAMDIVN_HCLK4_HALF;
          ^

drivers/cpufreq/s3c2440-cpufreq.c:182:2: note: here
case 4:
^~~~

Both look like the fallthrough is intentional, so add the new "fallthrough;" keyword.

---
 drivers/cpufreq/s3c2440-cpufreq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/s3c2440-cpufreq.c +2 -0
index 148e8aedefa9..2011fb9c03a4 100644
@@ -173,12 +173,14 @@ static void s3c2440_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
 
 	case 6:
 		camdiv |= S3C2440_CAMDIVN_HCLK3_HALF;
+		fallthrough;
 	case 3:
 		clkdiv |= S3C2440_CLKDIVN_HDIVN_3_6;
 		break;
 
 	case 8:
 		camdiv |= S3C2440_CAMDIVN_HCLK4_HALF;
+		fallthrough;
 	case 4:
 		clkdiv |= S3C2440_CLKDIVN_HDIVN_4_8;
 		break;
Signature · 1 line
2.29.2
Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Apparently nobody has so far caught this warning, I hit it in randconfig build testing:

drivers/cpufreq/s3c2440-cpufreq.c: In function 's3c2440_cpufreq_setdivs':
drivers/cpufreq/s3c2440-cpufreq.c:175:10: error: this statement may fall through [-Werror=implicit-fallthrough=]

   camdiv |= S3C2440_CAMDIVN_HCLK3_HALF;
          ^

drivers/cpufreq/s3c2440-cpufreq.c:176:2: note: here
case 3:
^~~~
drivers/cpufreq/s3c2440-cpufreq.c:181:10: error: this statement may fall through [-Werror=implicit-fallthrough=]

   camdiv |= S3C2440_CAMDIVN_HCLK4_HALF;
          ^

drivers/cpufreq/s3c2440-cpufreq.c:182:2: note: here
case 4:
^~~~

Quoted 7 lines

Both look like the fallthrough is intentional, so add the new "fallthrough;" keyword.

---
 drivers/cpufreq/s3c2440-cpufreq.c | 2 ++
 1 file changed, 2 insertions(+)

I think I saw it but back then implicit-fallthrough was not an error :)

LGTM:

Best regards,
Krzysztof

maintainer Applied
#2 lore raw
In reply to Arnd Bergmann
Quoted 36 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Apparently nobody has so far caught this warning, I hit it in randconfig build testing:

drivers/cpufreq/s3c2440-cpufreq.c: In function 's3c2440_cpufreq_setdivs':
drivers/cpufreq/s3c2440-cpufreq.c:175:10: error: this statement may fall through [-Werror=implicit-fallthrough=]

   camdiv |= S3C2440_CAMDIVN_HCLK3_HALF;
          ^

drivers/cpufreq/s3c2440-cpufreq.c:176:2: note: here
case 3:
^~~~
drivers/cpufreq/s3c2440-cpufreq.c:181:10: error: this statement may fall through [-Werror=implicit-fallthrough=]

   camdiv |= S3C2440_CAMDIVN_HCLK4_HALF;
          ^

drivers/cpufreq/s3c2440-cpufreq.c:182:2: note: here
case 4:
^~~~

Both look like the fallthrough is intentional, so add the new "fallthrough;" keyword.

---
 drivers/cpufreq/s3c2440-cpufreq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/s3c2440-cpufreq.c +1 -0
index 148e8aedefa9..2011fb9c03a4 100644
@@ -173,12 +173,14 @@ static void s3c2440_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
 
 	case 6:
 		camdiv |= S3C2440_CAMDIVN_HCLK3_HALF;
+		fallthrough;

drivers/cpufreq/s3c2440-cpufreq.c static void s3c2440_cpufreq_setdivs(struct s3c_cpufreq_config *cfg) · line 186

Quoted 10 lines
drivers/cpufreq/s3c2440-cpufreq.c +1 -0
 	case 3:
 		clkdiv |= S3C2440_CLKDIVN_HDIVN_3_6;
 		break;
 
 	case 8:
 		camdiv |= S3C2440_CAMDIVN_HCLK4_HALF;
+		fallthrough;
 	case 4:
 		clkdiv |= S3C2440_CLKDIVN_HDIVN_4_8;
 		break;

Applied. Thanks.

Signature · 1 line
viresh