diff options
author | pjd <pjd@FreeBSD.org> | 2009-09-06 07:32:16 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2009-09-06 07:32:16 +0000 |
commit | aa12b3e9c9ecf42d7b88c1c9d1f52e2147073c90 (patch) | |
tree | be4ac6bde726c89249f65e0990fecf21560997ef /sys/netipsec | |
parent | 78cb45a022757ba6fc9297cf3af4380f2adcdfae (diff) | |
download | FreeBSD-src-aa12b3e9c9ecf42d7b88c1c9d1f52e2147073c90.zip FreeBSD-src-aa12b3e9c9ecf42d7b88c1c9d1f52e2147073c90.tar.gz |
Improve code a bit by eliminating goto and having one unlock per lock.
Diffstat (limited to 'sys/netipsec')
-rw-r--r-- | sys/netipsec/key.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index 99dce21..081e697 100644 --- a/sys/netipsec/key.c +++ b/sys/netipsec/key.c @@ -918,15 +918,14 @@ key_allocsa_policy(const struct secasindex *saidx) state_valid = saorder_state_valid_prefer_new; arraysize = N(saorder_state_valid_prefer_new); } - SAHTREE_UNLOCK(); - goto found; + break; } } SAHTREE_UNLOCK(); - return NULL; + if (sah == NULL) + return NULL; - found: /* search valid state */ for (stateidx = 0; stateidx < arraysize; stateidx++) { sav = key_do_allocsa_policy(sah, state_valid[stateidx]); |