summaryrefslogtreecommitdiffstats
path: root/sys/dev/sio/sio_pccard.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2005-09-19 03:10:21 +0000
committerimp <imp@FreeBSD.org>2005-09-19 03:10:21 +0000
commit4e70215e6bf590140205774753c8b0a1f1fe9a36 (patch)
treec3358cebc77043ea8b2a3a5036b02dad6a674b7e /sys/dev/sio/sio_pccard.c
parent37a0bbb7e543c6b2a2f055d676d5a94f781d7738 (diff)
downloadFreeBSD-src-4e70215e6bf590140205774753c8b0a1f1fe9a36.zip
FreeBSD-src-4e70215e6bf590140205774753c8b0a1f1fe9a36.tar.gz
Make sure that we call if_free(ifp) after bus_teardown_intr. Since we
could get an interrupt after we free the ifp, and the interrupt handler depended on the ifp being still alive, this could, in theory, cause a crash. Eliminate this possibility by moving the if_free to after the bus_teardown_intr() call.
Diffstat (limited to 'sys/dev/sio/sio_pccard.c')
-rw-r--r--sys/dev/sio/sio_pccard.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/sys/dev/sio/sio_pccard.c b/sys/dev/sio/sio_pccard.c
index b715828..5c2ba77 100644
--- a/sys/dev/sio/sio_pccard.c
+++ b/sys/dev/sio/sio_pccard.c
@@ -44,23 +44,15 @@ __FBSDID("$FreeBSD$");
#include <dev/sio/siovar.h>
-#include "pccarddevs.h"
-
static int sio_pccard_attach(device_t dev);
-static int sio_pccard_match(device_t self);
static int sio_pccard_probe(device_t dev);
static device_method_t sio_pccard_methods[] = {
/* Device interface */
- DEVMETHOD(device_probe, pccard_compat_probe),
- DEVMETHOD(device_attach, pccard_compat_attach),
+ DEVMETHOD(device_probe, sio_pccard_probe),
+ DEVMETHOD(device_attach, sio_pccard_attach),
DEVMETHOD(device_detach, siodetach),
- /* Card interface */
- DEVMETHOD(card_compat_match, sio_pccard_match),
- DEVMETHOD(card_compat_probe, sio_pccard_probe),
- DEVMETHOD(card_compat_attach, sio_pccard_attach),
-
{ 0, 0 }
};
@@ -71,7 +63,7 @@ static driver_t sio_pccard_driver = {
};
static int
-sio_pccard_match(device_t dev)
+sio_pccard_probe(device_t dev)
{
int error = 0;
u_int32_t fcn = PCCARD_FUNCTION_UNSPEC;
@@ -79,6 +71,7 @@ sio_pccard_match(device_t dev)
error = pccard_get_function(dev, &fcn);
if (error != 0)
return (error);
+
/*
* If a serial card, we are likely the right driver. However,
* some serial cards are better servered by other drivers, so
@@ -86,27 +79,22 @@ sio_pccard_match(device_t dev)
*/
if (fcn == PCCARD_FUNCTION_SERIAL)
return (-100);
-
- return(ENXIO);
+ return (ENXIO);
}
static int
-sio_pccard_probe(dev)
+sio_pccard_attach(dev)
device_t dev;
{
+ int err;
#ifdef PC98
SET_FLAG(dev, SET_IFTYPE(COM_IF_MODEM_CARD));
#endif
/* Do not probe IRQ - pccard doesn't turn on the interrupt line */
/* until bus_setup_intr */
- return (sioprobe(dev, 0, 0UL, 1));
-}
-
-static int
-sio_pccard_attach(dev)
- device_t dev;
-{
+ if ((err = sioprobe(dev, 0, 0UL, 1)) != 0)
+ return (err);
return (sioattach(dev, 0, 0UL));
}
OpenPOWER on IntegriCloud