summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorjmcneill <jmcneill@NetBSD.org>2006-06-25 14:49:49 +0000
committerjmcneill <jmcneill@NetBSD.org>2006-06-25 14:49:49 +0000
commit507a433a4ed55b32601281daf2dcd2e874016f60 (patch)
tree28013b92f42b4926770ddb950a5ae8c81a820e80 /sys
parent186054d0dd6c1c56e869f08c13ae2511987ba9a7 (diff)
Make sure that a powerhook was successfully established before trying to
disestablish it on detach.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/com.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c
index 4e03571e1d2..309a448096b 100644
--- a/sys/dev/ic/com.c
+++ b/sys/dev/ic/com.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.245 2006/06/25 00:39:21 perry Exp $ */
+/* $NetBSD: com.c,v 1.246 2006/06/25 14:49:49 jmcneill Exp $ */
/*-
* Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.245 2006/06/25 00:39:21 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.246 2006/06/25 14:49:49 jmcneill Exp $");
#include "opt_com.h"
#include "opt_ddb.h"
@@ -676,7 +676,8 @@ com_detach(struct device *self, int flags)
int maj, mn;
/* kill the power hook */
- powerhook_disestablish(sc->sc_powerhook);
+ if (sc->sc_powerhook != NULL)
+ powerhook_disestablish(sc->sc_powerhook);
/* locate the major number */
maj = cdevsw_lookup_major(&com_cdevsw);