mtd: rawnand: Mark expected switch fall-throughs
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Fri, 8 Feb 2019 17:49:30 +0000 (11:49 -0600)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 21 Mar 2019 15:44:55 +0000 (16:44 +0100)
In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.

This patch fixes the following warning:

drivers/mtd/nand/raw/diskonchip.c: In function ‘doc_probe’:
./include/linux/printk.h:303:2: warning: this statement may fall through [-Wimplicit-fallthrough=]
  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/diskonchip.c:1479:4: note: in expansion of macro ‘pr_err’
    pr_err("DiskOnChip Millennium Plus 32MB is not supported, ignoring.\n");
    ^~~~~~
drivers/mtd/nand/raw/diskonchip.c:1480:3: note: here
   default:
   ^~~~~~~
drivers/mtd/nand/raw/nandsim.c: In function ‘ns_init_module’:
drivers/mtd/nand/raw/nandsim.c:2254:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
    chip->bbt_options |= NAND_BBT_NO_OOB;
drivers/mtd/nand/raw/nandsim.c:2255:2: note: here
  case 1:
  ^~~~
drivers/mtd/nand/raw/nuc900_nand.c: In function ‘nuc900_nand_command_lp’:
./arch/x86/include/asm/io.h:91:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
 #define __raw_writel __writel
drivers/mtd/nand/raw/nuc900_nand.c:52:2: note: in expansion of macro ‘__raw_writel’
  __raw_writel((val), (dev)->reg + REG_SMCMD)
  ^~~~~~~~~~~~
drivers/mtd/nand/raw/nuc900_nand.c:196:3: note: in expansion of macro ‘write_cmd_reg’
   write_cmd_reg(nand, NAND_CMD_READSTART);
   ^~~~~~~~~~~~~
drivers/mtd/nand/raw/nuc900_nand.c:197:2: note: here
  default:
  ^~~~~~~
drivers/mtd/nand/raw/omap_elm.c: In function ‘elm_context_restore’:
drivers/mtd/nand/raw/omap_elm.c:512:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
    elm_write_reg(info, ELM_SYNDROME_FRAGMENT_4 + offset,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      regs->elm_syndrome_fragment_4[i]);
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/omap_elm.c:514:3: note: here
   case BCH8_ECC:
   ^~~~
drivers/mtd/nand/raw/omap_elm.c:517:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
    elm_write_reg(info, ELM_SYNDROME_FRAGMENT_2 + offset,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      regs->elm_syndrome_fragment_2[i]);
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/omap_elm.c:519:3: note: here
   case BCH4_ECC:
   ^~~~
drivers/mtd/nand/raw/omap_elm.c: In function ‘elm_context_save’:
drivers/mtd/nand/raw/omap_elm.c:466:37: warning: this statement may fall through [-Wimplicit-fallthrough=]
    regs->elm_syndrome_fragment_4[i] = elm_read_reg(info,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      ELM_SYNDROME_FRAGMENT_4 + offset);
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/omap_elm.c:468:3: note: here
   case BCH8_ECC:
   ^~~~
drivers/mtd/nand/raw/omap_elm.c:471:37: warning: this statement may fall through [-Wimplicit-fallthrough=]
    regs->elm_syndrome_fragment_2[i] = elm_read_reg(info,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      ELM_SYNDROME_FRAGMENT_2 + offset);
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/omap_elm.c:473:3: note: here
   case BCH4_ECC:
   ^~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/diskonchip.c
drivers/mtd/nand/raw/nandsim.c
drivers/mtd/nand/raw/nuc900_nand.c
drivers/mtd/nand/raw/omap_elm.c

index 53f57e0f007e25654c773b73b1c0f56b35699b14..ead54c90f2d1bd3bcc1774bb652d00247902d0e0 100644 (file)
@@ -1477,6 +1477,7 @@ static int __init doc_probe(unsigned long physadr)
                        break;
                case DOC_ChipID_DocMilPlus32:
                        pr_err("DiskOnChip Millennium Plus 32MB is not supported, ignoring.\n");
+                       /* fall through */
                default:
                        ret = -ENODEV;
                        goto notfound;
index 933d1a629c519874d3a0f35771b620cf5e5c20f7..edf5fd3d5f07f2e2ae312c199fe4c9f7f7c91bed 100644 (file)
@@ -2251,9 +2251,11 @@ static int __init ns_init_module(void)
 
        switch (bbt) {
        case 2:
-                chip->bbt_options |= NAND_BBT_NO_OOB;
+               chip->bbt_options |= NAND_BBT_NO_OOB;
+               /* fall through */
        case 1:
-                chip->bbt_options |= NAND_BBT_USE_FLASH;
+               chip->bbt_options |= NAND_BBT_USE_FLASH;
+               /* fall through */
        case 0:
                break;
        default:
index 38b1994e7ed3bd66babf350c035c3a5a0f9f2153..56fa84029482978589105fbddbbf3efc20708a25 100644 (file)
@@ -192,8 +192,9 @@ static void nuc900_nand_command_lp(struct nand_chip *chip,
                return;
 
        case NAND_CMD_READ0:
-
                write_cmd_reg(nand, NAND_CMD_READSTART);
+               /* fall through */
+
        default:
 
                if (!chip->legacy.dev_ready) {
index a3f32f939cc1732a1a2938696019dfe9c7bf88a9..94c6401ef32fd81a66001e8f73f2d88e033a6784 100644 (file)
@@ -465,11 +465,13 @@ static int elm_context_save(struct elm_info *info)
                                        ELM_SYNDROME_FRAGMENT_5 + offset);
                        regs->elm_syndrome_fragment_4[i] = elm_read_reg(info,
                                        ELM_SYNDROME_FRAGMENT_4 + offset);
+                       /* fall through */
                case BCH8_ECC:
                        regs->elm_syndrome_fragment_3[i] = elm_read_reg(info,
                                        ELM_SYNDROME_FRAGMENT_3 + offset);
                        regs->elm_syndrome_fragment_2[i] = elm_read_reg(info,
                                        ELM_SYNDROME_FRAGMENT_2 + offset);
+                       /* fall through */
                case BCH4_ECC:
                        regs->elm_syndrome_fragment_1[i] = elm_read_reg(info,
                                        ELM_SYNDROME_FRAGMENT_1 + offset);
@@ -511,11 +513,13 @@ static int elm_context_restore(struct elm_info *info)
                                        regs->elm_syndrome_fragment_5[i]);
                        elm_write_reg(info, ELM_SYNDROME_FRAGMENT_4 + offset,
                                        regs->elm_syndrome_fragment_4[i]);
+                       /* fall through */
                case BCH8_ECC:
                        elm_write_reg(info, ELM_SYNDROME_FRAGMENT_3 + offset,
                                        regs->elm_syndrome_fragment_3[i]);
                        elm_write_reg(info, ELM_SYNDROME_FRAGMENT_2 + offset,
                                        regs->elm_syndrome_fragment_2[i]);
+                       /* fall through */
                case BCH4_ECC:
                        elm_write_reg(info, ELM_SYNDROME_FRAGMENT_1 + offset,
                                        regs->elm_syndrome_fragment_1[i]);