Skip to contentSkip to conversation

ipmi: kcs_bmc: mark expected switch fall-through in kcs_bmc_handle_data

PATCH In review Gustavo A. R. Silva 3 participants 4 messages Feb 14, 2018 – Feb 16, 2018 IPMI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipmi: kcs_bmc: mark expected switch fall-through in kcs_bmc_handle_data

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Addresses-Coverity-ID: 1465255 ("Missing break in switch")

---
This code was compiled with GCC 7.3.0

 drivers/char/ipmi/kcs_bmc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/char/ipmi/kcs_bmc.c +1 -0
index 3a3498a..6476bfb 100644
@@ -95,6 +95,7 @@ static void kcs_bmc_handle_data(struct kcs_bmc *kcs_bmc)
 	switch (kcs_bmc->phase) {
 	case KCS_PHASE_WRITE_START:
 		kcs_bmc->phase = KCS_PHASE_WRITE_DATA;
+		/* fall through */
 
 	case KCS_PHASE_WRITE_DATA:
 		if (kcs_bmc->data_in_idx < KCS_MSG_BUFSIZ) {
Signature · 1 line
2.7.4
#1 lore raw
Quoted 2 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Thanks, queued for next release.

-corey

Quoted 20 lines

Addresses-Coverity-ID: 1465255 ("Missing break in switch")

---
This code was compiled with GCC 7.3.0

  drivers/char/ipmi/kcs_bmc.c | 1 +
  1 file changed, 1 insertion(+)
drivers/char/ipmi/kcs_bmc.c +1 -0
index 3a3498a..6476bfb 100644
@@ -95,6 +95,7 @@ static void kcs_bmc_handle_data(struct kcs_bmc *kcs_bmc)
  	switch (kcs_bmc->phase) {
  	case KCS_PHASE_WRITE_START:
  		kcs_bmc->phase = KCS_PHASE_WRITE_DATA;
+		/* fall through */
 
  	case KCS_PHASE_WRITE_DATA:
  		if (kcs_bmc->data_in_idx < KCS_MSG_BUFSIZ) {
#2 lore raw
Quoted 6 lines · Corey Minyard
Quoted 2 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Thanks, queued for next release.

Thanks, Corey.
--
Gustavo

#3 lore raw
In reply to Corey Minyard
Quoted 16 lines · Corey Minyard
Quoted 2 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Thanks, queued for next release.

-corey

Quoted 8 lines

Addresses-Coverity-ID: 1465255 ("Missing break in switch")

---
This code was compiled with GCC 7.3.0

  drivers/char/ipmi/kcs_bmc.c | 1 +

  1 file changed, 1 insertion(+)
Quoted 10 lines
Quoted 10 lines
drivers/char/ipmi/kcs_bmc.c +0 -0
index 3a3498a..6476bfb 100644
@@ -95,6 +95,7 @@ static void kcs_bmc_handle_data(struct kcs_bmc 
 *kcs_bmc)
       switch (kcs_bmc->phase) {

      case KCS_PHASE_WRITE_START:
          kcs_bmc->phase = KCS_PHASE_WRITE_DATA;
+        /* fall through */

Thanks, Gustavo. I see many modules have '/* fall through */', but I thought it was a just C comment, I didn't add it for making code clean. Learned it, thank you! :-)

Quoted 4 lines
Quoted 2 lines

        case KCS_PHASE_WRITE_DATA:
          if (kcs_bmc->data_in_idx < KCS_MSG_BUFSIZ) {