From 1407a44862f4b2ac941575a97a67ab92298ee497 Mon Sep 17 00:00:00 2001 From: Bowen Wang Date: Thu, 7 Mar 2024 16:49:25 +0800 Subject: [PATCH] drivers/pci/pci.c: fix warning when CONFIG_PCI_ASSIGN_ALL_BUSES=n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pci/pci.c:415:34: warning: variable ‘res’ set but not used [-Wunused-but-set-variable] 415 | FAR struct pci_resource_s *res; | ^~~ pci/pci.c: In function ‘pci_scan_bus’: pci/pci.c:663:32: warning: unused variable ‘ctrl’ [-Wunused-variable] 663 | FAR struct pci_controller_s *ctrl = bus->ctrl; Signed-off-by: Bowen Wang --- drivers/pci/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 7c08feb04e..cd6eef64fa 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -681,6 +681,8 @@ static void pci_setup_device(FAR struct pci_device_s *dev, int max_bar, pci_read_config_byte(dev, PCI_COMMAND, &cmd); pci_write_config_byte(dev, PCI_COMMAND, cmd & ~PCI_COMMAND_IO & ~PCI_COMMAND_MEMORY); +#else + uint32_t tmp; #endif for (bar = 0; bar < max_bar; bar++) @@ -754,8 +756,6 @@ static void pci_setup_device(FAR struct pci_device_s *dev, int max_bar, res->start += size; #else UNUSED(res); - uint32_t tmp; - pci_read_config_dword(dev, base_address_0, &tmp); if (mask & PCI_BASE_ADDRESS_SPACE_IO) { @@ -1032,7 +1032,7 @@ static void pci_scan_bus(FAR struct pci_bus_s *bus) child_bus->parent_bus = bus; #ifdef CONFIG_PCI_ASSIGN_ALL_BUSES - child_bus->number = ctrl->busno++; + child_bus->number = bus->ctrl->busno++; #endif list_add_tail(&bus->children, &child_bus->node);