summaryrefslogtreecommitdiffstats
path: root/sys/dev/softraid.c
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2015-07-28 15:42:23 +0000
committerkrw <krw@openbsd.org>2015-07-28 15:42:23 +0000
commit3e20b5176c744225e257224454d21451ea9c7629 (patch)
treeb36b10bf4a237be11a1d6f128a85b432c044cc6f /sys/dev/softraid.c
parentnormalize disclaimer to license.template; noted by reyk (diff)
downloadwireguard-openbsd-3e20b5176c744225e257224454d21451ea9c7629.tar.xz
wireguard-openbsd-3e20b5176c744225e257224454d21451ea9c7629.zip
Tweak a couple of [SLIST|TAILQ]_REMOVE() usages in loops to a more
obvious idiom. ok bluhm@ jsing@
Diffstat (limited to 'sys/dev/softraid.c')
-rw-r--r--sys/dev/softraid.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 84978e8735f..c4517bcae6f 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.361 2015/07/27 04:11:58 halex Exp $ */
+/* $OpenBSD: softraid.c,v 1.362 2015/07/28 15:42:23 krw Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -1755,15 +1755,15 @@ sr_hotplug_unregister(struct sr_discipline *sd, void *func)
DEVNAME(sd->sd_sc), sd->sd_meta->ssd_devname, func);
/* make sure we are on the list yet */
- SLIST_FOREACH(mhe, &sr_hotplug_callbacks, shl_link)
- if (mhe->sh_hotplug == func) {
- SLIST_REMOVE(&sr_hotplug_callbacks, mhe,
- sr_hotplug_list, shl_link);
- free(mhe, M_DEVBUF, 0);
- if (SLIST_EMPTY(&sr_hotplug_callbacks))
- SLIST_INIT(&sr_hotplug_callbacks);
- return;
- }
+ SLIST_FOREACH(mhe, &sr_hotplug_callbacks, shl_link) {
+ if (mhe->sh_hotplug == func)
+ break;
+ }
+ if (mhe != NULL) {
+ SLIST_REMOVE(&sr_hotplug_callbacks, mhe,
+ sr_hotplug_list, shl_link);
+ free(mhe, M_DEVBUF, 0);
+ }
}
void
@@ -3848,7 +3848,7 @@ void
sr_discipline_free(struct sr_discipline *sd)
{
struct sr_softc *sc;
- struct sr_discipline *sdtmp1, *sdtmp2;
+ struct sr_discipline *sdtmp1;
struct sr_meta_opt_head *som;
struct sr_meta_opt_item *omi, *omi_next;
@@ -3882,12 +3882,12 @@ sr_discipline_free(struct sr_discipline *sd)
sc->sc_targets[sd->sd_target] = NULL;
}
- TAILQ_FOREACH_SAFE(sdtmp1, &sc->sc_dis_list, sd_link, sdtmp2) {
- if (sdtmp1 == sd) {
- TAILQ_REMOVE(&sc->sc_dis_list, sd, sd_link);
+ TAILQ_FOREACH(sdtmp1, &sc->sc_dis_list, sd_link) {
+ if (sdtmp1 == sd)
break;
- }
}
+ if (sdtmp1 != NULL)
+ TAILQ_REMOVE(&sc->sc_dis_list, sd, sd_link);
explicit_bzero(sd, sizeof *sd);
free(sd, M_DEVBUF, 0);