summaryrefslogtreecommitdiff
path: root/sys/dev/usb/udcf.c
diff options
context:
space:
mode:
authorJacob Meuser <jakemsr@cvs.openbsd.org>2010-10-23 16:14:08 +0000
committerJacob Meuser <jakemsr@cvs.openbsd.org>2010-10-23 16:14:08 +0000
commitdb9058be5229697001a5d46f83b0dd4ab66a8695 (patch)
tree9eea560f87590a129aa562cec2d2b6040ae93079 /sys/dev/usb/udcf.c
parentbdc249af6535dd1a757df6cdbe97fbd299400ed4 (diff)
check that a timeout(9) has been initialized before deleting it
ok phessler
Diffstat (limited to 'sys/dev/usb/udcf.c')
-rw-r--r--sys/dev/usb/udcf.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/dev/usb/udcf.c b/sys/dev/usb/udcf.c
index 6716aa390d8..0d42aa2bf2c 100644
--- a/sys/dev/usb/udcf.c
+++ b/sys/dev/usb/udcf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udcf.c,v 1.49 2010/10/23 15:42:09 jakemsr Exp $ */
+/* $OpenBSD: udcf.c,v 1.50 2010/10/23 16:14:07 jakemsr Exp $ */
/*
* Copyright (c) 2006, 2007, 2008 Marc Balmer <mbalmer@openbsd.org>
@@ -334,13 +334,20 @@ udcf_detach(struct device *self, int flags)
{
struct udcf_softc *sc = (struct udcf_softc *)self;
- timeout_del(&sc->sc_to);
- timeout_del(&sc->sc_bv_to);
- timeout_del(&sc->sc_mg_to);
- timeout_del(&sc->sc_sl_to);
- timeout_del(&sc->sc_it_to);
- if (sc->sc_detect_ct)
- timeout_del(&sc->sc_ct_to);
+ if (timeout_initialized(&sc->sc_to))
+ timeout_del(&sc->sc_to);
+ if (timeout_initialized(&sc->sc_bv_to))
+ timeout_del(&sc->sc_bv_to);
+ if (timeout_initialized(&sc->sc_mg_to))
+ timeout_del(&sc->sc_mg_to);
+ if (timeout_initialized(&sc->sc_sl_to))
+ timeout_del(&sc->sc_sl_to);
+ if (timeout_initialized(&sc->sc_it_to))
+ timeout_del(&sc->sc_it_to);
+ if (sc->sc_detect_ct) {
+ if (timeout_initialized(&sc->sc_ct_to))
+ timeout_del(&sc->sc_ct_to);
+ }
/* Unregister the clock with the kernel */
sensordev_deinstall(&sc->sc_sensordev);