Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167569041
D55413.id172361.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D55413.id172361.diff
View Options
diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c
--- a/sys/dev/asmc/asmc.c
+++ b/sys/dev/asmc/asmc.c
@@ -795,25 +795,21 @@
if (sc->sc_irq == NULL) {
device_printf(dev, "unable to allocate IRQ resource\n");
ret = ENXIO;
- goto err2;
+ goto err;
}
ret = bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_MISC | INTR_MPSAFE,
asmc_sms_intrfast, NULL, dev, &sc->sc_cookie);
if (ret) {
device_printf(dev, "unable to setup SMS IRQ\n");
- goto err1;
+ goto err;
}
+
nosms:
return (0);
-err1:
- bus_release_resource(dev, SYS_RES_IRQ, sc->sc_rid_irq, sc->sc_irq);
-err2:
- bus_release_resource(dev, SYS_RES_IOPORT, sc->sc_rid_port,
- sc->sc_ioport);
- mtx_destroy(&sc->sc_mtx);
- if (sc->sc_sms_tq)
- taskqueue_free(sc->sc_sms_tq);
+
+err:
+ asmc_detach(dev);
return (ret);
}
@@ -826,16 +822,25 @@
if (sc->sc_sms_tq) {
taskqueue_drain(sc->sc_sms_tq, &sc->sc_sms_task);
taskqueue_free(sc->sc_sms_tq);
+ sc->sc_sms_tq = NULL;
}
- if (sc->sc_cookie)
+ if (sc->sc_cookie) {
bus_teardown_intr(dev, sc->sc_irq, sc->sc_cookie);
- if (sc->sc_irq)
+ sc->sc_cookie = NULL;
+ }
+ if (sc->sc_irq) {
bus_release_resource(dev, SYS_RES_IRQ, sc->sc_rid_irq,
sc->sc_irq);
- if (sc->sc_ioport)
+ sc->sc_irq = NULL;
+ }
+ if (sc->sc_ioport) {
bus_release_resource(dev, SYS_RES_IOPORT, sc->sc_rid_port,
sc->sc_ioport);
- mtx_destroy(&sc->sc_mtx);
+ sc->sc_ioport = NULL;
+ }
+ if (mtx_initialized(&sc->sc_mtx)) {
+ mtx_destroy(&sc->sc_mtx);
+ }
return (0);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Aug 23, 6:18 PM (10 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37156279
Default Alt Text
D55413.id172361.diff (1 KB)
Attached To
Mode
D55413: asmc: resource cleanup simplifications
Attached
Detach File
Event Timeline
Log In to Comment