Skip to contentSkip to conversation

mtd: mxc_nand: Fix sparse warning

PATCH In review Fabio Estevam 2 participants 4 messages Feb 11, 2013 – Feb 13, 2013

Subsystems (3)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 mtd: mxc_nand: Fix sparse warning

From: Fabio Estevam <[email protected]>

Fix the following sparse warning:

drivers/mtd/nand/mxc_nand.c:269:25: warning: duplicate const

---
 drivers/mtd/nand/mxc_nand.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/mxc_nand.c +1 -1
index 45204e4..37037cb 100644
@@ -266,7 +266,7 @@ static struct nand_ecclayout nandv2_hw_eccoob_4k = {
 	}
 };
 
-static const char const *part_probes[] = {
+static const char *part_probes[] = {
 	"cmdlinepart", "RedBoot", "ofpart", NULL };
 
 static void memcpy32_fromio(void *trg, const void __iomem  *src, size_t size)
Signature · 1 line
1.7.9.5
#1 lore raw

Hi Fabio,

Quoted 16 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Fix the following sparse warning:

drivers/mtd/nand/mxc_nand.c:269:25: warning: duplicate const

---
 drivers/mtd/nand/mxc_nand.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/mxc_nand.c +0 -0
index 45204e4..37037cb 100644

drivers/mtd/nand/mxc_nand.c static struct nand_ecclayout nandv2_hw_eccoob_4k = { · line 271

Quoted 7 lines
drivers/mtd/nand/mxc_nand.c +1 -1
@@ -266,7 +266,7 @@ static struct nand_ecclayout nandv2_hw_eccoob_4k = {
        }
 };
 
-static const char const *part_probes[] = {
+static const char *part_probes[] = {
        "cmdlinepart", "RedBoot", "ofpart", NULL };
 

Are you sure checkpatch.pl didn't complain about this patch? I think it will complain, because it's expecting to see this instead:

  static const char * const part_probes[] = {

And then you'll probably have to cast part_probes to (const char **) on the mtd_device_parse_register call to remove every warning.

Hope this helps,

Signature · 1 line
    Ezequiel
author reviewer
#2 lore raw

Hi Ezequiel,

Quoted 8 lines · Ezequiel Garcia
Quoted 8 lines
drivers/mtd/nand/mxc_nand.c +0 -0
index 45204e4..37037cb 100644
@@ -266,7 +266,7 @@ static struct nand_ecclayout nandv2_hw_eccoob_4k = {
        }
 };
 
Quoted 6 lines

drivers/mtd/nand/mxc_nand.c static struct nand_ecclayout nandv2_hw_eccoob_4k = { · line 271

Quoted 4 lines
drivers/mtd/nand/mxc_nand.c +1 -1
-static const char const *part_probes[] = {
+static const char *part_probes[] = {
        "cmdlinepart", "RedBoot", "ofpart", NULL };
 

Are you sure checkpatch.pl didn't complain about this patch?

Yes, checkpatch complains, but it seems that checkpatch and sparse are in contradiction then.

Regards,

Fabio Estevam

#3 lore raw

Hi Fabio,

Quoted 17 lines · Fabio Estevam
Quoted 8 lines · Ezequiel Garcia
Quoted 8 lines
drivers/mtd/nand/mxc_nand.c +0 -0
index 45204e4..37037cb 100644
@@ -266,7 +266,7 @@ static struct nand_ecclayout nandv2_hw_eccoob_4k = {
        }
 };
 
Quoted 6 lines

drivers/mtd/nand/mxc_nand.c static struct nand_ecclayout nandv2_hw_eccoob_4k = { · line 271

Quoted 4 lines
drivers/mtd/nand/mxc_nand.c +1 -1
-static const char const *part_probes[] = {
+static const char *part_probes[] = {
        "cmdlinepart", "RedBoot", "ofpart", NULL };
 

Are you sure checkpatch.pl didn't complain about this patch?

Quoted 3 lines

Yes, checkpatch complains, but it seems that checkpatch and sparse are in contradiction then.

Well it doesn't seem in contradiction to me. You fixed a redundant double const:

-static const char const *part_probes[] = {

+static const char *part_probes[] = {
        "cmdlinepart", "RedBoot", "ofpart", NULL };

Notice how the 'const char const' type is nonesense. And checkpatch.pl will suggest you this in turn:

static const char * const part_probes[] = {
        "cmdlinepart", "RedBoot", "ofpart", NULL };

Notice how the second 'const' is after the pointer.

My point is, the code you're fixing needs a fix,
just not the fix you were proposing :-)

Hope it helped,

Signature · 1 line
    Ezequiel