diff mbox series

[RFC,10/78] hw/ide/atapi.c: add fallthrough pseudo-keyword

Message ID cef77c3b4f13c967f371d203d1aba515b05f3555.1697183082.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:47 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/ide/atapi.c | 1 +
 1 file changed, 1 insertion(+)

Comments

John Snow Oct. 13, 2023, 10:27 p.m. UTC | #1
On Fri, Oct 13, 2023 at 3:50 AM Emmanouil Pitsidianakis
<manos.pitsidianakis@linaro.org> 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/ide/atapi.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
> index dcc39df9a4..85c74a5ffe 100644
> --- a/hw/ide/atapi.c
> +++ b/hw/ide/atapi.c
> @@ -1189,53 +1189,54 @@ static void cmd_read_disc_information(IDEState *s, uint8_t* buf)
>  static void cmd_read_dvd_structure(IDEState *s, uint8_t* buf)
>  {
>      int max_len;
>      int media = buf[1];
>      int format = buf[7];
>      int ret;
>
>      max_len = lduw_be_p(buf + 8);
>
>      if (format < 0xff) {
>          if (media_is_cd(s)) {
>              ide_atapi_cmd_error(s, ILLEGAL_REQUEST,
>                                  ASC_INCOMPATIBLE_FORMAT);
>              return;
>          } else if (!media_present(s)) {
>              ide_atapi_cmd_error(s, ILLEGAL_REQUEST,
>                                  ASC_INV_FIELD_IN_CMD_PACKET);
>              return;
>          }
>      }
>
>      memset(buf, 0, max_len > IDE_DMA_BUF_SECTORS * BDRV_SECTOR_SIZE + 4 ?
>             IDE_DMA_BUF_SECTORS * BDRV_SECTOR_SIZE + 4 : max_len);
>
>      switch (format) {
>          case 0x00 ... 0x7f:
>          case 0xff:
>              if (media == 0) {
>                  ret = ide_dvd_read_structure(s, format, buf, buf);
>
>                  if (ret < 0) {
>                      ide_atapi_cmd_error(s, ILLEGAL_REQUEST, -ret);
>                  } else {
>                      ide_atapi_cmd_reply(s, ret, max_len);
>                  }
>
>                  break;
>              }
>              /* TODO: BD support, fall through for now */
> +            fallthrough;

ACK. For a moment I was wondering if this was something new to gcc,
but I guess it's just a macro you made O:-)

Acked-by: John Snow <jsnow@redhat.com>

>
>          /* Generic disk structures */
>          case 0x80: /* TODO: AACS volume identifier */
>          case 0x81: /* TODO: AACS media serial number */
>          case 0x82: /* TODO: AACS media identifier */
>          case 0x83: /* TODO: AACS media key block */
>          case 0x90: /* TODO: List of recognized format layers */
>          case 0xc0: /* TODO: Write protection status */
>          default:
>              ide_atapi_cmd_error(s, ILLEGAL_REQUEST,
>                                  ASC_INV_FIELD_IN_CMD_PACKET);
>              break;
>      }
>  }
> --
> 2.39.2
>
diff mbox series

Patch

diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index dcc39df9a4..85c74a5ffe 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -1189,53 +1189,54 @@  static void cmd_read_disc_information(IDEState *s, uint8_t* buf)
 static void cmd_read_dvd_structure(IDEState *s, uint8_t* buf)
 {
     int max_len;
     int media = buf[1];
     int format = buf[7];
     int ret;
 
     max_len = lduw_be_p(buf + 8);
 
     if (format < 0xff) {
         if (media_is_cd(s)) {
             ide_atapi_cmd_error(s, ILLEGAL_REQUEST,
                                 ASC_INCOMPATIBLE_FORMAT);
             return;
         } else if (!media_present(s)) {
             ide_atapi_cmd_error(s, ILLEGAL_REQUEST,
                                 ASC_INV_FIELD_IN_CMD_PACKET);
             return;
         }
     }
 
     memset(buf, 0, max_len > IDE_DMA_BUF_SECTORS * BDRV_SECTOR_SIZE + 4 ?
            IDE_DMA_BUF_SECTORS * BDRV_SECTOR_SIZE + 4 : max_len);
 
     switch (format) {
         case 0x00 ... 0x7f:
         case 0xff:
             if (media == 0) {
                 ret = ide_dvd_read_structure(s, format, buf, buf);
 
                 if (ret < 0) {
                     ide_atapi_cmd_error(s, ILLEGAL_REQUEST, -ret);
                 } else {
                     ide_atapi_cmd_reply(s, ret, max_len);
                 }
 
                 break;
             }
             /* TODO: BD support, fall through for now */
+            fallthrough;
 
         /* Generic disk structures */
         case 0x80: /* TODO: AACS volume identifier */
         case 0x81: /* TODO: AACS media serial number */
         case 0x82: /* TODO: AACS media identifier */
         case 0x83: /* TODO: AACS media key block */
         case 0x90: /* TODO: List of recognized format layers */
         case 0xc0: /* TODO: Write protection status */
         default:
             ide_atapi_cmd_error(s, ILLEGAL_REQUEST,
                                 ASC_INV_FIELD_IN_CMD_PACKET);
             break;
     }
 }