diff mbox series

[RFC,v2,63/78] hw/ipmi: add fallthrough pseudo-keyword

Message ID bb840f22f424db1d386475d5c0e2d50ee5b50a26.1697183699.git.manos.pitsidianakis@linaro.org (mailing list archive)
State New, archived
Headers show
Series Strict disable implicit fallthrough | expand

Commit Message

Manos Pitsidianakis Oct. 13, 2023, 7:57 a.m. UTC
In preparation of raising -Wimplicit-fallthrough to 5, replace all
fall-through comments with the fallthrough attribute pseudo-keyword.

Signed-off-by: Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org>
---
 hw/ipmi/ipmi_bmc_extern.c | 2 +-
 hw/ipmi/smbus_ipmi.c      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c
index e232d35ba2..b2ca02b21f 100644
--- a/hw/ipmi/ipmi_bmc_extern.c
+++ b/hw/ipmi/ipmi_bmc_extern.c
@@ -168,15 +168,15 @@  static void extern_timeout(void *opaque)
 static void addchar(IPMIBmcExtern *ibe, unsigned char ch)
 {
     switch (ch) {
     case VM_MSG_CHAR:
     case VM_CMD_CHAR:
     case VM_ESCAPE_CHAR:
         ibe->outbuf[ibe->outlen] = VM_ESCAPE_CHAR;
         ibe->outlen++;
         ch |= 0x10;
-        /* fall through */
+        fallthrough;
     default:
         ibe->outbuf[ibe->outlen] = ch;
         ibe->outlen++;
     }
 }
diff --git a/hw/ipmi/smbus_ipmi.c b/hw/ipmi/smbus_ipmi.c
index d0991ab7f9..58f5328a19 100644
--- a/hw/ipmi/smbus_ipmi.c
+++ b/hw/ipmi/smbus_ipmi.c
@@ -207,90 +207,90 @@  static int ipmi_load_readbuf(SMBusIPMIDevice *sid)
 static int ipmi_write_data(SMBusDevice *dev, uint8_t *buf, uint8_t len)
 {
     SMBusIPMIDevice *sid = SMBUS_IPMI(dev);
     bool send = false;
     uint8_t cmd;
     int ret = 0;
 
     /* length is guaranteed to be >= 1. */
     cmd = *buf++;
     len--;
 
     /* Handle read request, which don't have any data in the write part. */
     switch (cmd) {
     case SSIF_IPMI_RESPONSE:
         sid->currblk = 0;
         ret = ipmi_load_readbuf(sid);
         break;
 
     case SSIF_IPMI_MULTI_PART_RESPONSE_MIDDLE:
         sid->currblk++;
         ret = ipmi_load_readbuf(sid);
         break;
 
     case SSIF_IPMI_MULTI_PART_RETRY:
         if (len >= 1) {
             sid->currblk = buf[0];
             ret = ipmi_load_readbuf(sid);
         } else {
             ret = -1;
         }
         break;
 
     default:
         break;
     }
 
     /* This should be a message write, make the length is there and correct. */
     if (len >= 1) {
         if (*buf != len - 1 || *buf > MAX_SSIF_IPMI_MSG_CHUNK) {
             return -1; /* Bogus message */
         }
         buf++;
         len--;
     }
 
     switch (cmd) {
     case SSIF_IPMI_REQUEST:
         send = true;
-        /* FALLTHRU */
+        fallthrough;
     case SSIF_IPMI_MULTI_PART_REQUEST_START:
         if (len < 2) {
             return -1; /* Bogus. */
         }
         memcpy(sid->inmsg, buf, len);
         sid->inlen = len;
         break;
 
     case SSIF_IPMI_MULTI_PART_REQUEST_END:
         send = true;
-        /* FALLTHRU */
+        fallthrough;
     case SSIF_IPMI_MULTI_PART_REQUEST_MIDDLE:
         if (!sid->inlen) {
             return -1; /* Bogus. */
         }
         if (sid->inlen + len > MAX_SSIF_IPMI_MSG_SIZE) {
             sid->inlen = 0; /* Discard the message. */
             return -1; /* Bogus. */
         }
         if (len < 32) {
             /*
              * Special hack, a multi-part middle that is less than 32 bytes
              * marks the end of a message.  The specification is fairly
              * confusing, so some systems to this, even sending a zero
              * length end message to mark the end.
              */
             send = true;
         }
         if (len > 0) {
             memcpy(sid->inmsg + sid->inlen, buf, len);
         }
         sid->inlen += len;
         break;
     }
 
     if (send && sid->inlen) {
         smbus_ipmi_send_msg(sid);
     }
 
     return ret;
 }