CardBus patch

Chuck Tuffli ctuffli at gmail.com
Thu May 11 21:00:18 PDT 2006


Tripped across this today. cbb_probe() assumes that the subclass field 
is unique. This patch further qualifies the check to verify that the 
device belongs to the bus class as well before claiming the device.

---chuck
Index: sys/dev/pccard/pccbb/pccbb.c
===================================================================
RCS file: /local/dcvs/src/sys/dev/pccard/pccbb/pccbb.c,v
retrieving revision 1.12
diff -u -r1.12 pccbb.c
--- sys/dev/pccard/pccbb/pccbb.c	19 Dec 2005 01:18:58 -0000	1.12
+++ sys/dev/pccard/pccbb/pccbb.c	12 May 2006 03:39:02 -0000
@@ -373,6 +373,7 @@
 	const char *name;
 	uint32_t progif;
 	uint32_t subclass;
+	uint32_t class;
 
 	/*
 	 * Do we know that we support the chipset?  If so, then we
@@ -391,9 +392,10 @@
 	 * are supported by the pcic driver.  This should help us be more
 	 * future proof.
 	 */
+	class = pci_get_class(brdev);
 	subclass = pci_get_subclass(brdev);
 	progif = pci_get_progif(brdev);
-	if (subclass == PCIS_BRIDGE_CARDBUS && progif == 0) {
+	if (class == PCIC_BRIDGE && subclass == PCIS_BRIDGE_CARDBUS && progif == 0) {
 		device_set_desc(brdev, "PCI-CardBus Bridge");
 		return (0);
 	}




More information about the Kernel mailing list