summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2006-09-21 08:42:12 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2006-09-21 08:42:12 +0000
commitfdf7707d7618e8dee83dcf8cc243c9e26febff2b (patch)
tree1295935a95ab25a9f32dc7b14a2e7fea742ff4e6 /sys/scsi
parent68a4fac67b5a92577d2158f6a888b2a319339f98 (diff)
when we probe and find devices on the scsibus, we allocate a scsi_link
struct for it and keep it in the midlayer. however, this struct was never free'd on detach. since we only do hotplugging of controllers (and the scsibus and devices get hotplugged as a matter of course), we now walk the list of scsi_link structs and free them on detach of scsibus. ok marco@
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/scsiconf.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index 5f314ef65c4..3bc11fe542c 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.c,v 1.111 2006/07/29 02:40:45 krw Exp $ */
+/* $OpenBSD: scsiconf.c,v 1.112 2006/09/21 08:42:11 dlg Exp $ */
/* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */
/*
@@ -173,14 +173,19 @@ int
scsibusdetach(struct device *dev, int type)
{
struct scsibus_softc *sb = (struct scsibus_softc *)dev;
- int i, error;
+ int i, j, error;
if ((error = config_detach_children(dev, type)) != 0)
return (error);
for (i = 0; i < sb->sc_buswidth; i++) {
- if (sb->sc_link[i] != NULL)
+ if (sb->sc_link[i] != NULL) {
+ for (j = 0; j < sb->adapter_link->luns; j++) {
+ if (sb->sc_link[i][j] != NULL)
+ free(sb->sc_link[i][j], M_DEVBUF);
+ }
free(sb->sc_link[i], M_DEVBUF);
+ }
}
free(sb->sc_link, M_DEVBUF);