All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Desaulniers <nick.desaulniers@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: bhelgaas@google.com, tglx@linutronix.de, mingo@redhat.com,
	hpa@zytor.com, x86@kernel.org, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Nick Desaulniers <nick.desaulniers@gmail.com>
Subject: [PATCH] x86/PCI: fix duplicate 'const' declaration specifier
Date: Tue,  9 May 2017 20:01:21 -0700	[thread overview]
Message-ID: <20170510030121.19667-1-nick.desaulniers@gmail.com> (raw)

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

             reply	other threads:[~2017-05-10  3:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10  3:01 Nick Desaulniers [this message]
2017-05-10  5:53 ` [PATCH] x86/PCI: fix duplicate 'const' declaration specifier Nick Desaulniers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170510030121.19667-1-nick.desaulniers@gmail.com \
    --to=nick.desaulniers@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.