summaryrefslogtreecommitdiffstats
path: root/sys/dev/cardbus
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2002-11-14 05:12:02 +0000
committerimp <imp@FreeBSD.org>2002-11-14 05:12:02 +0000
commit8eb26d87337d61751b7ea8c4e8678c237b0a1c5c (patch)
tree32476c0ce1356e39343acc3a78f0a6da58039ab6 /sys/dev/cardbus
parentc35b7acf66761c94e3dff76ab6b7525af579ab92 (diff)
downloadFreeBSD-src-8eb26d87337d61751b7ea8c4e8678c237b0a1c5c.zip
FreeBSD-src-8eb26d87337d61751b7ea8c4e8678c237b0a1c5c.tar.gz
MFp4:
o Add a diagnostic for an 'impossible' condition. o Collapse common code.
Diffstat (limited to 'sys/dev/cardbus')
-rw-r--r--sys/dev/cardbus/cardbus.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c
index 7c227af..35f7a7e 100644
--- a/sys/dev/cardbus/cardbus.c
+++ b/sys/dev/cardbus/cardbus.c
@@ -289,16 +289,13 @@ cardbus_detach_card(device_t cbdev)
struct cardbus_devinfo *dinfo = device_get_ivars(devlist[tmp]);
int status = device_get_state(devlist[tmp]);
- if (status == DS_ATTACHED || status == DS_BUSY) {
- device_detach(dinfo->pci.cfg.dev);
- cardbus_release_all_resources(cbdev, dinfo);
- device_delete_child(cbdev, devlist[tmp]);
- cardbus_freecfg(dinfo);
- } else {
- cardbus_release_all_resources(cbdev, dinfo);
- device_delete_child(cbdev, devlist[tmp]);
- cardbus_freecfg(dinfo);
- }
+ if (dinfo->pci.cfg.dev != devlist[tmp])
+ device_printf(cbdev, "devinfo dev mismatch\n");
+ if (status == DS_ATTACHED || status == DS_BUSY)
+ device_detach(devlist[tmp]);
+ cardbus_release_all_resources(cbdev, dinfo);
+ device_delete_child(cbdev, devlist[tmp]);
+ cardbus_freecfg(dinfo);
}
POWER_DISABLE_SOCKET(device_get_parent(cbdev), cbdev);
free(devlist, M_TEMP);
OpenPOWER on IntegriCloud