Blob Blame History Raw
From 5d0c4393b207660fb9d6b08caed03ac85435fcd9 Mon Sep 17 00:00:00 2001
From: Bjorn Helgaas <bhelgaas@google.com>
Date: Fri, 21 Jan 2022 12:33:30 -0600
Subject: USB: hcd-pci: Use PCI_STD_NUM_BARS when checking standard BARs
Git-commit: 5d0c4393b207660fb9d6b08caed03ac85435fcd9
Patch-mainline: v5.18-rc1
References: bsc#1152489

usb_hcd_pci_probe() searches for an I/O BAR using a combination of
PCI_STD_NUM_BARS (to control loop iteration) and PCI_ROM_RESOURCE (to check
whether the loop exits without finding anything).

Use PCI_STD_NUM_BARS consistently.

No functional change since PCI_STD_NUM_BARS == PCI_ROM_RESOURCE, but this
removes a dependency on that relationship and makes the code read better.

Fixes: c9c13ba428ef ("PCI: Add PCI_STD_NUM_BARS for the number of standard BARs")
Cc: Denis Efremov <efremov@linux.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20220121183330.1141702-1-helgaas@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/usb/core/hcd-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index d630cccd2e6ea..784466117c92f 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -248,7 +248,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id,
 					hcd->rsrc_len, driver->description))
 				break;
 		}
-		if (region == PCI_ROM_RESOURCE) {
+		if (region == PCI_STD_NUM_BARS) {
 			dev_dbg(&dev->dev, "no i/o regions available\n");
 			retval = -EBUSY;
 			goto put_hcd;
-- 
2.36.0