Skip to contentSkip to conversation

drivers/pci/probe: Move variable bridge inside ifdef

PATCH In review Anders Roxell 2 participants 2 messages Jul 21, 2018 – Jul 23, 2018 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/pci/probe: Move variable bridge inside ifdef

When CONFIG_PCI_QUIRKS isn't enabled we get the warning below:
drivers/pci/probe.c: In function ‘pci_bus_read_dev_vendor_id’:
drivers/pci/probe.c:2221:18: warning: unused variable ‘bridge’ [-Wunused-variable]

  struct pci_dev *bridge = bus->self;
                  ^~~~~~

Move the declaration of variable bridge to inside the ifdef CONFIG_PCI_QUIRKS.

Fixes ac5ea104a279 ("PCI: Workaround IDT switch ACS Source Validation erratum")
---
 drivers/pci/probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/probe.c +1 -1
index 1c581346c5b9..7a5323798312 100644
@@ -2218,9 +2218,9 @@ bool pci_bus_generic_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
 bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
 				int timeout)
 {
+#ifdef CONFIG_PCI_QUIRKS
 	struct pci_dev *bridge = bus->self;
 
-#ifdef CONFIG_PCI_QUIRKS
 	/*
 	 * Certain IDT switches have an issue where they improperly trigger
 	 * ACS Source Validation errors on completions for config reads.
Signature · 1 line
2.18.0
#1 lore raw
Quoted 11 lines · Anders Roxell

When CONFIG_PCI_QUIRKS isn't enabled we get the warning below:
drivers/pci/probe.c: In function ‘pci_bus_read_dev_vendor_id’:
drivers/pci/probe.c:2221:18: warning: unused variable ‘bridge’ [-Wunused-variable]

  struct pci_dev *bridge = bus->self;
                  ^~~~~~

Move the declaration of variable bridge to inside the ifdef CONFIG_PCI_QUIRKS.

Fixes ac5ea104a279 ("PCI: Workaround IDT switch ACS Source Validation erratum")

I folded this into the original commit on pci/enumeration, thanks!

Quoted 22 lines
---
 drivers/pci/probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/probe.c +1 -1
index 1c581346c5b9..7a5323798312 100644
@@ -2218,9 +2218,9 @@ bool pci_bus_generic_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
 bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
 				int timeout)
 {
+#ifdef CONFIG_PCI_QUIRKS
 	struct pci_dev *bridge = bus->self;
 
-#ifdef CONFIG_PCI_QUIRKS
 	/*
 	 * Certain IDT switches have an issue where they improperly trigger
 	 * ACS Source Validation errors on completions for config reads.
Signature · 1 line
2.18.0