Skip to contentSkip to conversation

x86/PCI: fix duplicate 'const' declaration specifier

PATCH In review Nick Desaulniers 1 participant 2 messages May 10, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/PCI: fix duplicate 'const' declaration specifier

Found with -Wduplicate-decl-specifier, a relatively new compiler flag in GCC7, and Clang.

list_for_each_entry() eventually calls container_of(), which marks the loop variable as const. The first argument to list_for_each_entry() is a type, which should not already be marked const, otherwise the loop variable is marked const twice.

While this particular call site does not modify the loop variable, trying to do so would already result in a compile time failure, so we can remove the current const. Other call sites do not mark the loop variable const.

---
 arch/x86/pci/mmconfig-shared.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/pci/mmconfig-shared.c +1 -1
index d1b47d5bc9c3..925083ed1b2b 100644
@@ -643,7 +643,7 @@ static void __init __pci_mmcfg_init(int early)
 		return;
 
 	if (pcibios_last_bus < 0) {
-		const struct pci_mmcfg_region *cfg;
+		struct pci_mmcfg_region *cfg;
 
 		list_for_each_entry(cfg, &pci_mmcfg_list, list) {
 			if (cfg->segment)
Signature · 1 line
2.11.0