summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2000-01-29 03:02:55 +0000
committerbde <bde@FreeBSD.org>2000-01-29 03:02:55 +0000
commit4c824a9165d1134985945a4a2886b3b88453cd8c (patch)
treec9966c05da60b22d0203e782f86d5fb83f47e52f
parente81c093824f41c50256483eece8716995acd21ac (diff)
downloadFreeBSD-src-4c824a9165d1134985945a4a2886b3b88453cd8c.zip
FreeBSD-src-4c824a9165d1134985945a4a2886b3b88453cd8c.tar.gz
"Completed" the previous fix. Return ENOMEM on memory allocation failure
in sioattach(), not ENXIO. Free resources before returning early in sioprobe() and sioattach().
-rw-r--r--sys/dev/sio/sio.c9
-rw-r--r--sys/isa/sio.c9
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index 4fcc02a..a409a55 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -677,6 +677,7 @@ sioprobe(dev)
if (COM_LLCONSOLE(flags)) {
printf("sio%d: reserved for low-level i/o\n",
device_get_unit(dev));
+ bus_release_resource(dev, SYS_RES_IOPORT, rid, port);
return (ENXIO);
}
@@ -1048,7 +1049,13 @@ sioattach(dev)
if (siosetwater(com, com->it_in.c_ispeed) != 0) {
enable_intr();
free(com, M_DEVBUF);
- return (ENXIO);
+ /*
+ * Leave i/o resources allocated if this is a `cn'-level
+ * console, so that other devices can't snarf them.
+ */
+ if (iobase != siocniobase)
+ bus_release_resource(dev, SYS_RES_IOPORT, rid, port);
+ return (ENOMEM);
}
enable_intr();
termioschars(&com->it_in);
diff --git a/sys/isa/sio.c b/sys/isa/sio.c
index 4fcc02a..a409a55 100644
--- a/sys/isa/sio.c
+++ b/sys/isa/sio.c
@@ -677,6 +677,7 @@ sioprobe(dev)
if (COM_LLCONSOLE(flags)) {
printf("sio%d: reserved for low-level i/o\n",
device_get_unit(dev));
+ bus_release_resource(dev, SYS_RES_IOPORT, rid, port);
return (ENXIO);
}
@@ -1048,7 +1049,13 @@ sioattach(dev)
if (siosetwater(com, com->it_in.c_ispeed) != 0) {
enable_intr();
free(com, M_DEVBUF);
- return (ENXIO);
+ /*
+ * Leave i/o resources allocated if this is a `cn'-level
+ * console, so that other devices can't snarf them.
+ */
+ if (iobase != siocniobase)
+ bus_release_resource(dev, SYS_RES_IOPORT, rid, port);
+ return (ENOMEM);
}
enable_intr();
termioschars(&com->it_in);
OpenPOWER on IntegriCloud