[PATCH] mtd: mxc_nand: Fix sparse warning

Ezequiel Garcia elezegarcia at gmail.com
Wed Feb 13 03:40:26 EST 2013


Hi Fabio,

On Tue, Feb 12, 2013 at 5:50 PM, Fabio Estevam <festevam at gmail.com> wrote:
> On Tue, Feb 12, 2013 at 12:39 AM, Ezequiel Garcia <elezegarcia at gmail.com> wrote:
>
>>> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
>>> index 45204e4..37037cb 100644
>>> --- a/drivers/mtd/nand/mxc_nand.c
>>> +++ b/drivers/mtd/nand/mxc_nand.c
>>> @@ -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?
>
> 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,

-- 
    Ezequiel



More information about the linux-mtd mailing list