summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2006-10-01 10:42:19 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2006-10-01 10:42:19 +0000
commit2c74780ce5f1897162a4e7ec24c1dea78b33f85e (patch)
tree1f23a184383a91c367b22d49540a6f16ed430b68
parent0c171c414722971475865221f9b39abd3297b487 (diff)
Free sensors on detach.
ok dlg@
-rw-r--r--sys/scsi/safte.c9
-rw-r--r--sys/scsi/ses.c14
2 files changed, 10 insertions, 13 deletions
diff --git a/sys/scsi/safte.c b/sys/scsi/safte.c
index af60ab70ddd..ea6ef9fd9c8 100644
--- a/sys/scsi/safte.c
+++ b/sys/scsi/safte.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: safte.c,v 1.29 2006/07/29 02:40:45 krw Exp $ */
+/* $OpenBSD: safte.c,v 1.30 2006/10/01 10:42:18 grange Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -221,12 +221,9 @@ safte_detach(struct device *self, int flags)
if (sc->sc_nsensors > 0) {
sensor_task_unregister(sc);
- /*
- * we can't free the sensors since there is no mechanism to
- * take them out of the sensor list. mark them invalid instead.
- */
for (i = 0; i < sc->sc_nsensors; i++)
- sc->sc_sensors[i].se_sensor.flags |= SENSOR_FINVALID;
+ sensor_del(&sc->sc_sensors[i].se_sensor);
+ free(sc->sc_sensors, M_DEVBUF);
}
if (sc->sc_encbuf != NULL)
diff --git a/sys/scsi/ses.c b/sys/scsi/ses.c
index 957ecff4c1d..b7a5e77bb6b 100644
--- a/sys/scsi/ses.c
+++ b/sys/scsi/ses.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ses.c,v 1.39 2006/07/29 02:40:46 krw Exp $ */
+/* $OpenBSD: ses.c,v 1.40 2006/10/01 10:42:18 grange Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -227,13 +227,13 @@ ses_detach(struct device *self, int flags)
if (!TAILQ_EMPTY(&sc->sc_sensors)) {
sensor_task_unregister(sc);
- /*
- * We can't free the sensors once theyre in the systems sensor
- * list, so just mark them as invalid.
- */
- TAILQ_FOREACH(sensor, &sc->sc_sensors, se_entry)
- sensor->se_sensor.flags |= SENSOR_FINVALID;
+ while (!TAILQ_EMPTY(&sc->sc_sensors)) {
+ sensor = TAILQ_FIRST(&sc->sc_sensors);
+ sensor_del(&sensor->se_sensor);
+ TAILQ_REMOVE(&sc->sc_sensors, sensor, se_entry);
+ free(sensor, M_DEVBUF);
+ }
}
if (sc->sc_buf != NULL)