mtd: spi-nor: cqspi: remove duplicate const

Message ID 20170627153508.1329697-1-arnd@arndb.de
State Accepted
Commit 315e9c767d9a4668ad68cde1b57a14f916c90668
Headers show

Commit Message

Arnd Bergmann June 27, 2017, 3:34 p.m.
The variable was already marked 'const' before the previous
patch, but the qualifier was in an unusual place, and now the
extra 'const' causes a harmless warning:

drivers/mtd/spi-nor/cadence-quadspi.c:1286:34: error: duplicate 'const' declaration specifier [-Werror=duplicate-decl-specifier]

This removes the other 'const' instead.

Fixes: f993c123b461 ("mtd: spi-nor: cqspi: make of_device_ids const")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 drivers/mtd/spi-nor/cadence-quadspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.9.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

Comments

Cyrille Pitchen June 27, 2017, 7:48 p.m. | #1
Le 27/06/2017 à 18:11, Marek Vasut a écrit :
> On 06/27/2017 05:34 PM, Arnd Bergmann wrote:
>> The variable was already marked 'const' before the previous
>> patch, but the qualifier was in an unusual place, and now the
>> extra 'const' causes a harmless warning:
>>
>> drivers/mtd/spi-nor/cadence-quadspi.c:1286:34: error: duplicate 'const' declaration specifier [-Werror=duplicate-decl-specifier]
>>
>> This removes the other 'const' instead.
> 
> Isn't that const array const elements , thus two consts ?
> IMO the original code is correct.

Indeed the 2 'const' don't have the same meaning so the original code
may be correct but with an array like cqspi_dt_ids[] we can't write
"cqspi_dt_ids = (const struct of_device_id *)<right value>;" anyway.

So I think the 2nd 'const' is useless here then if this patch removes a
warning, let's apply it, right?

> 
>> Fixes: f993c123b461 ("mtd: spi-nor: cqspi: make of_device_ids const")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>  drivers/mtd/spi-nor/cadence-quadspi.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
>> index d315c326e72f..53c7d8e0327a 100644
>> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
>> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
>> @@ -1283,7 +1283,7 @@ static const struct dev_pm_ops cqspi__dev_pm_ops = {
>>  #define CQSPI_DEV_PM_OPS	NULL
>>  #endif
>>  
>> -static const struct of_device_id const cqspi_dt_ids[] = {
>> +static const struct of_device_id cqspi_dt_ids[] = {
>>  	{.compatible = "cdns,qspi-nor",},
>>  	{ /* end of table */ }
>>  };
>>
> 
>

Patch

diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
index d315c326e72f..53c7d8e0327a 100644
--- a/drivers/mtd/spi-nor/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/cadence-quadspi.c
@@ -1283,7 +1283,7 @@  static const struct dev_pm_ops cqspi__dev_pm_ops = {
 #define CQSPI_DEV_PM_OPS	NULL
 #endif
 
-static const struct of_device_id const cqspi_dt_ids[] = {
+static const struct of_device_id cqspi_dt_ids[] = {
 	{.compatible = "cdns,qspi-nor",},
 	{ /* end of table */ }
 };