Stopgap fix to avoid crash on detach if the attach failed due to eg

USB problems - just return in detach if the softc appears not to be
filled in completely.
(This is a common problem with usb and probably other drivers which
support detach; we need some API support to deal with this cleanly.)
This commit is contained in:
drochner 2007-07-11 20:13:14 +00:00
parent e8108f3e5b
commit e2da0057b3
1 changed files with 5 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/* $OpenBSD: if_rum.c,v 1.40 2006/09/18 16:20:20 damien Exp $ */
/* $NetBSD: if_rum.c,v 1.12 2007/06/09 12:13:12 kiyohara Exp $ */
/* $NetBSD: if_rum.c,v 1.13 2007/07/11 20:13:14 drochner Exp $ */
/*-
* Copyright (c) 2005, 2006 Damien Bergamini <damien.bergamini@free.fr>
@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.12 2007/06/09 12:13:12 kiyohara Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.13 2007/07/11 20:13:14 drochner Exp $");
#include "bpfilter.h"
@ -477,6 +477,9 @@ USB_DETACH(rum)
struct ifnet *ifp = &sc->sc_if;
int s;
if (!ifp->if_softc)
return 0;
s = splusb();
rum_stop(ifp, 1);