diff mbox series

[RFC,v3,65/78] hw/nvme: add fallthrough pseudo-keyword

Message ID 82f908be2888b88fd93f1c5531f54d25d1da1a59.1697186560.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, 8:46 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/nvme/ctrl.c | 24 ++++++++++++------------
 hw/nvme/dif.c  |  4 ++--
 2 files changed, 14 insertions(+), 14 deletions(-)

Comments

Klaus Jensen Nov. 15, 2023, 9:30 a.m. UTC | #1
On Oct 13 11:46, Emmanouil Pitsidianakis wrote:
> 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/nvme/ctrl.c | 24 ++++++++++++------------
>  hw/nvme/dif.c  |  4 ++--
>  2 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index f026245d1e..acb2012fb9 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
> @@ -1918,7 +1918,7 @@ static uint16_t nvme_zrm_finish(NvmeNamespace *ns, NvmeZone *zone)
>      case NVME_ZONE_STATE_IMPLICITLY_OPEN:
>      case NVME_ZONE_STATE_EXPLICITLY_OPEN:
>          nvme_aor_dec_open(ns);
> -        /* fallthrough */
> +        fallthrough;
>      case NVME_ZONE_STATE_CLOSED:
>          nvme_aor_dec_active(ns);
>  
> @@ -1929,7 +1929,7 @@ static uint16_t nvme_zrm_finish(NvmeNamespace *ns, NvmeZone *zone)
>              }
>          }
>  
> -        /* fallthrough */
> +        fallthrough;
>      case NVME_ZONE_STATE_EMPTY:
>          nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_FULL);
>          return NVME_SUCCESS;
> @@ -1946,7 +1946,7 @@ static uint16_t nvme_zrm_close(NvmeNamespace *ns, NvmeZone *zone)
>      case NVME_ZONE_STATE_IMPLICITLY_OPEN:
>          nvme_aor_dec_open(ns);
>          nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_CLOSED);
> -        /* fall through */
> +        fallthrough;
>      case NVME_ZONE_STATE_CLOSED:
>          return NVME_SUCCESS;
>  
> @@ -1961,7 +1961,7 @@ static uint16_t nvme_zrm_reset(NvmeNamespace *ns, NvmeZone *zone)
>      case NVME_ZONE_STATE_EXPLICITLY_OPEN:
>      case NVME_ZONE_STATE_IMPLICITLY_OPEN:
>          nvme_aor_dec_open(ns);
> -        /* fallthrough */
> +        fallthrough;
>      case NVME_ZONE_STATE_CLOSED:
>          nvme_aor_dec_active(ns);
>  
> @@ -1971,12 +1971,12 @@ static uint16_t nvme_zrm_reset(NvmeNamespace *ns, NvmeZone *zone)
>              }
>          }
>  
> -        /* fallthrough */
> +        fallthrough;
>      case NVME_ZONE_STATE_FULL:
>          zone->w_ptr = zone->d.zslba;
>          zone->d.wp = zone->w_ptr;
>          nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_EMPTY);
> -        /* fallthrough */
> +        fallthrough;
>      case NVME_ZONE_STATE_EMPTY:
>          return NVME_SUCCESS;
>  
> @@ -2017,7 +2017,7 @@ static uint16_t nvme_zrm_open_flags(NvmeCtrl *n, NvmeNamespace *ns,
>      case NVME_ZONE_STATE_EMPTY:
>          act = 1;
>  
> -        /* fallthrough */
> +        fallthrough;
>  
>      case NVME_ZONE_STATE_CLOSED:
>          if (n->params.auto_transition_zones) {
> @@ -2040,7 +2040,7 @@ static uint16_t nvme_zrm_open_flags(NvmeCtrl *n, NvmeNamespace *ns,
>              return NVME_SUCCESS;
>          }
>  
> -        /* fallthrough */
> +        fallthrough;
>  
>      case NVME_ZONE_STATE_IMPLICITLY_OPEN:
>          if (flags & NVME_ZRM_AUTO) {
> @@ -2049,7 +2049,7 @@ static uint16_t nvme_zrm_open_flags(NvmeCtrl *n, NvmeNamespace *ns,
>  
>          nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_EXPLICITLY_OPEN);
>  
> -        /* fallthrough */
> +        fallthrough;
>  
>      case NVME_ZONE_STATE_EXPLICITLY_OPEN:
>          if (flags & NVME_ZRM_ZRWA) {
> @@ -3582,7 +3582,7 @@ static uint16_t nvme_do_write(NvmeCtrl *n, NvmeRequest *req, bool append,
>                      return NVME_INVALID_PROT_INFO | NVME_DNR;
>                  }
>  
> -                /* fallthrough */
> +                fallthrough;
>  
>              case NVME_ID_NS_DPS_TYPE_2:
>                  if (piremap) {
> @@ -3737,7 +3737,7 @@ static uint16_t nvme_offline_zone(NvmeNamespace *ns, NvmeZone *zone,
>      switch (state) {
>      case NVME_ZONE_STATE_READ_ONLY:
>          nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_OFFLINE);
> -        /* fall through */
> +        fallthrough;
>      case NVME_ZONE_STATE_OFFLINE:
>          return NVME_SUCCESS;
>      default:
> @@ -4914,7 +4914,7 @@ static uint16_t nvme_cmd_effects(NvmeCtrl *n, uint8_t csi, uint32_t buf_len,
>      switch (NVME_CC_CSS(ldl_le_p(&n->bar.cc))) {
>      case NVME_CC_CSS_NVM:
>          src_iocs = nvme_cse_iocs_nvm;
> -        /* fall through */
> +        fallthrough;
>      case NVME_CC_CSS_ADMIN_ONLY:
>          break;
>      case NVME_CC_CSS_CSI:
> diff --git a/hw/nvme/dif.c b/hw/nvme/dif.c
> index 01b19c3373..00dd96bdb3 100644
> --- a/hw/nvme/dif.c
> +++ b/hw/nvme/dif.c
> @@ -161,7 +161,7 @@ static uint16_t nvme_dif_prchk_crc16(NvmeNamespace *ns, NvmeDifTuple *dif,
>              break;
>          }
>  
> -        /* fallthrough */
> +        fallthrough;
>      case NVME_ID_NS_DPS_TYPE_1:
>      case NVME_ID_NS_DPS_TYPE_2:
>          if (be16_to_cpu(dif->g16.apptag) != 0xffff) {
> @@ -229,7 +229,7 @@ static uint16_t nvme_dif_prchk_crc64(NvmeNamespace *ns, NvmeDifTuple *dif,
>              break;
>          }
>  
> -        /* fallthrough */
> +        fallthrough;
>      case NVME_ID_NS_DPS_TYPE_1:
>      case NVME_ID_NS_DPS_TYPE_2:
>          if (be16_to_cpu(dif->g64.apptag) != 0xffff) {
> -- 
> 2.39.2
> 
> 

Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
diff mbox series

Patch

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index f026245d1e..acb2012fb9 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -1918,7 +1918,7 @@  static uint16_t nvme_zrm_finish(NvmeNamespace *ns, NvmeZone *zone)
     case NVME_ZONE_STATE_IMPLICITLY_OPEN:
     case NVME_ZONE_STATE_EXPLICITLY_OPEN:
         nvme_aor_dec_open(ns);
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_CLOSED:
         nvme_aor_dec_active(ns);
 
@@ -1929,7 +1929,7 @@  static uint16_t nvme_zrm_finish(NvmeNamespace *ns, NvmeZone *zone)
             }
         }
 
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_EMPTY:
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_FULL);
         return NVME_SUCCESS;
@@ -1946,7 +1946,7 @@  static uint16_t nvme_zrm_close(NvmeNamespace *ns, NvmeZone *zone)
     case NVME_ZONE_STATE_IMPLICITLY_OPEN:
         nvme_aor_dec_open(ns);
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_CLOSED);
-        /* fall through */
+        fallthrough;
     case NVME_ZONE_STATE_CLOSED:
         return NVME_SUCCESS;
 
@@ -1961,7 +1961,7 @@  static uint16_t nvme_zrm_reset(NvmeNamespace *ns, NvmeZone *zone)
     case NVME_ZONE_STATE_EXPLICITLY_OPEN:
     case NVME_ZONE_STATE_IMPLICITLY_OPEN:
         nvme_aor_dec_open(ns);
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_CLOSED:
         nvme_aor_dec_active(ns);
 
@@ -1971,12 +1971,12 @@  static uint16_t nvme_zrm_reset(NvmeNamespace *ns, NvmeZone *zone)
             }
         }
 
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_FULL:
         zone->w_ptr = zone->d.zslba;
         zone->d.wp = zone->w_ptr;
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_EMPTY);
-        /* fallthrough */
+        fallthrough;
     case NVME_ZONE_STATE_EMPTY:
         return NVME_SUCCESS;
 
@@ -2017,7 +2017,7 @@  static uint16_t nvme_zrm_open_flags(NvmeCtrl *n, NvmeNamespace *ns,
     case NVME_ZONE_STATE_EMPTY:
         act = 1;
 
-        /* fallthrough */
+        fallthrough;
 
     case NVME_ZONE_STATE_CLOSED:
         if (n->params.auto_transition_zones) {
@@ -2040,7 +2040,7 @@  static uint16_t nvme_zrm_open_flags(NvmeCtrl *n, NvmeNamespace *ns,
             return NVME_SUCCESS;
         }
 
-        /* fallthrough */
+        fallthrough;
 
     case NVME_ZONE_STATE_IMPLICITLY_OPEN:
         if (flags & NVME_ZRM_AUTO) {
@@ -2049,7 +2049,7 @@  static uint16_t nvme_zrm_open_flags(NvmeCtrl *n, NvmeNamespace *ns,
 
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_EXPLICITLY_OPEN);
 
-        /* fallthrough */
+        fallthrough;
 
     case NVME_ZONE_STATE_EXPLICITLY_OPEN:
         if (flags & NVME_ZRM_ZRWA) {
@@ -3582,7 +3582,7 @@  static uint16_t nvme_do_write(NvmeCtrl *n, NvmeRequest *req, bool append,
                     return NVME_INVALID_PROT_INFO | NVME_DNR;
                 }
 
-                /* fallthrough */
+                fallthrough;
 
             case NVME_ID_NS_DPS_TYPE_2:
                 if (piremap) {
@@ -3737,7 +3737,7 @@  static uint16_t nvme_offline_zone(NvmeNamespace *ns, NvmeZone *zone,
     switch (state) {
     case NVME_ZONE_STATE_READ_ONLY:
         nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_OFFLINE);
-        /* fall through */
+        fallthrough;
     case NVME_ZONE_STATE_OFFLINE:
         return NVME_SUCCESS;
     default:
@@ -4914,7 +4914,7 @@  static uint16_t nvme_cmd_effects(NvmeCtrl *n, uint8_t csi, uint32_t buf_len,
     switch (NVME_CC_CSS(ldl_le_p(&n->bar.cc))) {
     case NVME_CC_CSS_NVM:
         src_iocs = nvme_cse_iocs_nvm;
-        /* fall through */
+        fallthrough;
     case NVME_CC_CSS_ADMIN_ONLY:
         break;
     case NVME_CC_CSS_CSI:
diff --git a/hw/nvme/dif.c b/hw/nvme/dif.c
index 01b19c3373..00dd96bdb3 100644
--- a/hw/nvme/dif.c
+++ b/hw/nvme/dif.c
@@ -161,7 +161,7 @@  static uint16_t nvme_dif_prchk_crc16(NvmeNamespace *ns, NvmeDifTuple *dif,
             break;
         }
 
-        /* fallthrough */
+        fallthrough;
     case NVME_ID_NS_DPS_TYPE_1:
     case NVME_ID_NS_DPS_TYPE_2:
         if (be16_to_cpu(dif->g16.apptag) != 0xffff) {
@@ -229,7 +229,7 @@  static uint16_t nvme_dif_prchk_crc64(NvmeNamespace *ns, NvmeDifTuple *dif,
             break;
         }
 
-        /* fallthrough */
+        fallthrough;
     case NVME_ID_NS_DPS_TYPE_1:
     case NVME_ID_NS_DPS_TYPE_2:
         if (be16_to_cpu(dif->g64.apptag) != 0xffff) {