Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638519 > unrolled thread

[PATCH] x86/PCI: fix duplicate 'const' declaration specifier

Started byNick Desaulniers <nick.desaulniers@gmail.com>
First post2017-05-10 05:10 +0200
Last post2017-05-10 08:00 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86/PCI: fix duplicate 'const' declaration specifier Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-05-10 05:10 +0200
    Re: [PATCH] x86/PCI: fix duplicate 'const' declaration specifier Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-05-10 08:00 +0200

#1638519 — [PATCH] x86/PCI: fix duplicate 'const' declaration specifier

FromNick Desaulniers <nick.desaulniers@gmail.com>
Date2017-05-10 05:10 +0200
Subject[PATCH] x86/PCI: fix duplicate 'const' declaration specifier
Message-ID<tFqaK-2Ri-5@gated-at.bofh.it>
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.

Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
---
 arch/x86/pci/mmconfig-shared.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index d1b47d5bc9c3..925083ed1b2b 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -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)
-- 
2.11.0

[toc] | [next] | [standalone]


#1638571

FromNick Desaulniers <nick.desaulniers@gmail.com>
Date2017-05-10 08:00 +0200
Message-ID<tFsPg-5e7-5@gated-at.bofh.it>
In reply to#1638519
Please disregard this patch.  I think I may have found a bug in Clang,
or at least an incompatibility with GCC 7.1.

Clang bug: https://bugs.llvm.org/show_bug.cgi?id=32985

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web