diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2010-10-23 16:14:08 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2010-10-23 16:14:08 +0000 |
commit | db9058be5229697001a5d46f83b0dd4ab66a8695 (patch) | |
tree | 9eea560f87590a129aa562cec2d2b6040ae93079 /sys/dev/usb | |
parent | bdc249af6535dd1a757df6cdbe97fbd299400ed4 (diff) |
check that a timeout(9) has been initialized before deleting it
ok phessler
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/hidkbd.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/if_aue.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/if_axe.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/if_cue.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/if_mos.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/if_otus.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/if_ral.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/if_rum.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/if_run.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/if_uath.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/if_udav.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/if_upgt.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/if_url.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/if_urtw.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/if_zyd.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/udcf.c | 23 | ||||
-rw-r--r-- | sys/dev/usb/umbg.c | 8 |
17 files changed, 81 insertions, 49 deletions
diff --git a/sys/dev/usb/hidkbd.c b/sys/dev/usb/hidkbd.c index 524900cea3b..6191a6851a9 100644 --- a/sys/dev/usb/hidkbd.c +++ b/sys/dev/usb/hidkbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hidkbd.c,v 1.3 2010/08/01 21:37:08 miod Exp $ */ +/* $OpenBSD: hidkbd.c,v 1.4 2010/10/23 16:14:06 jakemsr Exp $ */ /* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -224,7 +224,8 @@ hidkbd_detach(struct hidkbd *kbd, int flags) DPRINTF(("hidkbd_detach: sc=%p flags=%d\n", kbd->sc_device, flags)); #ifdef WSDISPLAY_COMPAT_RAWKBD - timeout_del(&kbd->sc_rawrepeat_ch); + if (timeout_initialized(&kbd->sc_rawrepeat_ch)) + timeout_del(&kbd->sc_rawrepeat_ch); #endif if (kbd->sc_console_keyboard) { diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index 673c12be3d3..3f7ee26dc4a 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_aue.c,v 1.80 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: if_aue.c,v 1.81 2010/10/23 16:14:06 jakemsr Exp $ */ /* $NetBSD: if_aue.c,v 1.82 2003/03/05 17:37:36 shiba Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -855,7 +855,8 @@ aue_detach(struct device *self, int flags) if (!sc->aue_attached) return (0); - timeout_del(&sc->aue_stat_ch); + if (timeout_initialized(&sc->aue_stat_ch)) + timeout_del(&sc->aue_stat_ch); /* * Remove any pending tasks. They cannot be executing because they run diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index 3d8fe570ab0..0e35444784a 100644 --- a/sys/dev/usb/if_axe.c +++ b/sys/dev/usb/if_axe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_axe.c,v 1.100 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: if_axe.c,v 1.101 2010/10/23 16:14:07 jakemsr Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Jonathan Gray <jsg@openbsd.org> @@ -835,7 +835,8 @@ axe_detach(struct device *self, int flags) if (!sc->axe_attached) return (0); - timeout_del(&sc->axe_stat_ch); + if (timeout_initialized(&sc->axe_stat_ch)) + timeout_del(&sc->axe_stat_ch); if (sc->axe_ep[AXE_ENDPT_TX] != NULL) usbd_abort_pipe(sc->axe_ep[AXE_ENDPT_TX]); diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index ddfc87d8aed..4708127c223 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cue.c,v 1.54 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: if_cue.c,v 1.55 2010/10/23 16:14:07 jakemsr Exp $ */ /* $NetBSD: if_cue.c,v 1.40 2002/07/11 21:14:26 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -561,7 +561,8 @@ cue_detach(struct device *self, int flags) if (!sc->cue_attached) return (0); - timeout_del(&sc->cue_stat_ch); + if (timeout_initialized(&sc->cue_stat_ch)) + timeout_del(&sc->cue_stat_ch); /* * Remove any pending task. It cannot be executing because it run diff --git a/sys/dev/usb/if_mos.c b/sys/dev/usb/if_mos.c index a23c4ffa5cb..dcb085ad0bf 100644 --- a/sys/dev/usb/if_mos.c +++ b/sys/dev/usb/if_mos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mos.c,v 1.9 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: if_mos.c,v 1.10 2010/10/23 16:14:07 jakemsr Exp $ */ /* * Copyright (c) 2008 Johann Christian Rode <jcrode@gmx.net> @@ -771,7 +771,8 @@ mos_detach(struct device *self, int flags) if (!sc->mos_attached) return (0); - timeout_del(&sc->mos_stat_ch); + if (timeout_initialized(&sc->mos_stat_ch)) + timeout_del(&sc->mos_stat_ch); if (sc->mos_ep[MOS_ENDPT_TX] != NULL) usbd_abort_pipe(sc->mos_ep[MOS_ENDPT_TX]); diff --git a/sys/dev/usb/if_otus.c b/sys/dev/usb/if_otus.c index 67bd16654af..8241187bda4 100644 --- a/sys/dev/usb/if_otus.c +++ b/sys/dev/usb/if_otus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_otus.c,v 1.19 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: if_otus.c,v 1.20 2010/10/23 16:14:07 jakemsr Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -250,8 +250,10 @@ otus_detach(struct device *self, int flags) while (sc->cmdq.queued > 0) tsleep(&sc->cmdq, 0, "cmdq", 0); - timeout_del(&sc->scan_to); - timeout_del(&sc->calib_to); + if (timeout_initialized(&sc->scan_to)) + timeout_del(&sc->scan_to); + if (timeout_initialized(&sc->calib_to)) + timeout_del(&sc->calib_to); if (ifp->if_flags != 0) { /* if_attach() has been called. */ ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index db26e36e055..4e7677f4ee9 100644 --- a/sys/dev/usb/if_ral.c +++ b/sys/dev/usb/if_ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ral.c,v 1.114 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: if_ral.c,v 1.115 2010/10/23 16:14:07 jakemsr Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -367,8 +367,10 @@ ural_detach(struct device *self, int flags) if_detach(ifp); usb_rem_task(sc->sc_udev, &sc->sc_task); - timeout_del(&sc->scan_to); - timeout_del(&sc->amrr_to); + if (timeout_initialized(&sc->scan_to)) + timeout_del(&sc->scan_to); + if (timeout_initialized(&sc->amrr_to)) + timeout_del(&sc->amrr_to); if (sc->amrr_xfer != NULL) { usbd_free_xfer(sc->amrr_xfer); diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c index ddffda0332d..b2cce3b8adb 100644 --- a/sys/dev/usb/if_rum.c +++ b/sys/dev/usb/if_rum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rum.c,v 1.91 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: if_rum.c,v 1.92 2010/10/23 16:14:07 jakemsr Exp $ */ /*- * Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr> @@ -464,8 +464,10 @@ rum_detach(struct device *self, int flags) if_detach(ifp); usb_rem_task(sc->sc_udev, &sc->sc_task); - timeout_del(&sc->scan_to); - timeout_del(&sc->amrr_to); + if (timeout_initialized(&sc->scan_to)) + timeout_del(&sc->scan_to); + if (timeout_initialized(&sc->amrr_to)) + timeout_del(&sc->amrr_to); if (sc->amrr_xfer != NULL) { usbd_free_xfer(sc->amrr_xfer); diff --git a/sys/dev/usb/if_run.c b/sys/dev/usb/if_run.c index 091f89bacb6..f7aa8c9aae4 100644 --- a/sys/dev/usb/if_run.c +++ b/sys/dev/usb/if_run.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_run.c,v 1.73 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: if_run.c,v 1.74 2010/10/23 16:14:07 jakemsr Exp $ */ /*- * Copyright (c) 2008-2010 Damien Bergamini <damien.bergamini@free.fr> @@ -595,8 +595,10 @@ run_detach(struct device *self, int flags) while (sc->cmdq.queued > 0) tsleep(&sc->cmdq, 0, "cmdq", 0); - timeout_del(&sc->scan_to); - timeout_del(&sc->calib_to); + if (timeout_initialized(&sc->scan_to)) + timeout_del(&sc->scan_to); + if (timeout_initialized(&sc->calib_to)) + timeout_del(&sc->calib_to); if (ifp->if_flags != 0) { /* if_attach() has been called */ ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); diff --git a/sys/dev/usb/if_uath.c b/sys/dev/usb/if_uath.c index 4fe2392ff16..fdfeca5dd18 100644 --- a/sys/dev/usb/if_uath.c +++ b/sys/dev/usb/if_uath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_uath.c,v 1.44 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: if_uath.c,v 1.45 2010/10/23 16:14:07 jakemsr Exp $ */ /*- * Copyright (c) 2006 @@ -447,8 +447,10 @@ uath_detach(struct device *self, int flags) /* post-firmware device */ usb_rem_task(sc->sc_udev, &sc->sc_task); - timeout_del(&sc->scan_to); - timeout_del(&sc->stat_to); + if (timeout_initialized(&sc->scan_to)) + timeout_del(&sc->scan_to); + if (timeout_initialized(&sc->stat_to)) + timeout_del(&sc->stat_to); /* abort and free xfers */ uath_free_tx_data_list(sc); diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c index 158edc8b8c3..51981954127 100644 --- a/sys/dev/usb/if_udav.c +++ b/sys/dev/usb/if_udav.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_udav.c,v 1.47 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: if_udav.c,v 1.48 2010/10/23 16:14:07 jakemsr Exp $ */ /* $NetBSD: if_udav.c,v 1.3 2004/04/23 17:25:25 itojun Exp $ */ /* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ /* @@ -333,7 +333,8 @@ udav_detach(struct device *self, int flags) if (!sc->sc_attached) return (0); - timeout_del(&sc->sc_stat_ch); + if (timeout_initialized(&sc->sc_stat_ch)) + timeout_del(&sc->sc_stat_ch); /* Remove any pending tasks */ usb_rem_task(sc->sc_udev, &sc->sc_tick_task); diff --git a/sys/dev/usb/if_upgt.c b/sys/dev/usb/if_upgt.c index 9041549656e..88cee518788 100644 --- a/sys/dev/usb/if_upgt.c +++ b/sys/dev/usb/if_upgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_upgt.c,v 1.51 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: if_upgt.c,v 1.52 2010/10/23 16:14:07 jakemsr Exp $ */ /* * Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org> @@ -486,8 +486,10 @@ upgt_detach(struct device *self, int flags) /* remove tasks and timeouts */ usb_rem_task(sc->sc_udev, &sc->sc_task_newstate); usb_rem_task(sc->sc_udev, &sc->sc_task_tx); - timeout_del(&sc->scan_to); - timeout_del(&sc->led_to); + if (timeout_initialized(&sc->scan_to)) + timeout_del(&sc->scan_to); + if (timeout_initialized(&sc->led_to)) + timeout_del(&sc->led_to); /* free xfers */ upgt_free_tx(sc); diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c index 42fe68d4111..c0b67dc261d 100644 --- a/sys/dev/usb/if_url.c +++ b/sys/dev/usb/if_url.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_url.c,v 1.57 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: if_url.c,v 1.58 2010/10/23 16:14:07 jakemsr Exp $ */ /* $NetBSD: if_url.c,v 1.6 2002/09/29 10:19:21 martin Exp $ */ /* * Copyright (c) 2001, 2002 @@ -339,7 +339,8 @@ url_detach(struct device *self, int flags) if (!sc->sc_attached) return (0); - timeout_del(&sc->sc_stat_ch); + if (timeout_initialized(&sc->sc_stat_ch)) + timeout_del(&sc->sc_stat_ch); /* Remove any pending tasks */ usb_rem_task(sc->sc_udev, &sc->sc_tick_task); diff --git a/sys/dev/usb/if_urtw.c b/sys/dev/usb/if_urtw.c index fbb076fcf4a..9cead0c4711 100644 --- a/sys/dev/usb/if_urtw.c +++ b/sys/dev/usb/if_urtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtw.c,v 1.32 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: if_urtw.c,v 1.33 2010/10/23 16:14:07 jakemsr Exp $ */ /*- * Copyright (c) 2009 Martynas Venckus <martynas@openbsd.org> @@ -780,8 +780,10 @@ urtw_detach(struct device *self, int flags) usb_rem_task(sc->sc_udev, &sc->sc_task); usb_rem_task(sc->sc_udev, &sc->sc_ledtask); - timeout_del(&sc->scan_to); - timeout_del(&sc->sc_led_ch); + if (timeout_initialized(&sc->scan_to)) + timeout_del(&sc->scan_to); + if (timeout_initialized(&sc->sc_led_ch)) + timeout_del(&sc->sc_led_ch); /* abort and free xfers */ urtw_free_tx_data_list(sc); diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index ca1cdc28939..c1066de374b 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_zyd.c,v 1.83 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: if_zyd.c,v 1.84 2010/10/23 16:14:07 jakemsr Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr> @@ -443,8 +443,10 @@ zyd_detach(struct device *self, int flags) s = splusb(); usb_rem_task(sc->sc_udev, &sc->sc_task); - timeout_del(&sc->scan_to); - timeout_del(&sc->amrr_to); + if (timeout_initialized(&sc->scan_to)) + timeout_del(&sc->scan_to); + if (timeout_initialized(&sc->amrr_to)) + timeout_del(&sc->amrr_to); zyd_close_pipes(sc); 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); diff --git a/sys/dev/usb/umbg.c b/sys/dev/usb/umbg.c index c4eb55831bc..029694bb01b 100644 --- a/sys/dev/usb/umbg.c +++ b/sys/dev/usb/umbg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umbg.c,v 1.13 2010/10/23 15:42:09 jakemsr Exp $ */ +/* $OpenBSD: umbg.c,v 1.14 2010/10/23 16:14:07 jakemsr Exp $ */ /* * Copyright (c) 2007 Marc Balmer <mbalmer@openbsd.org> @@ -296,8 +296,10 @@ umbg_detach(struct device *self, int flags) struct umbg_softc *sc = (struct umbg_softc *)self; usbd_status err; - timeout_del(&sc->sc_to); - timeout_del(&sc->sc_it_to); + if (timeout_initialized(&sc->sc_to)) + timeout_del(&sc->sc_to); + if (timeout_initialized(&sc->sc_it_to)) + timeout_del(&sc->sc_it_to); usb_rem_task(sc->sc_udev, &sc->sc_task); |