From 950ab2f81e52396a59a006f88d9fb39e32da6078 Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Sun, 6 Sep 2009 07:32:16 +0000 Subject: [PATCH] Improve code a bit by eliminating goto and having one unlock per lock. --- sys/netipsec/key.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index 99dce21b2f25..081e697eda43 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]);