Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net wg: Omit needless variable.



details:   https://anonhg.NetBSD.org/src/rev/9d94bad0cf42
branches:  trunk
changeset: 943352:9d94bad0cf42
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 31 20:26:46 2020 +0000

description:
wg: Omit needless variable.

diffstat:

 sys/net/if_wg.c |  16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diffs (51 lines):

diff -r ca9c92c9be16 -r 9d94bad0cf42 sys/net/if_wg.c
--- a/sys/net/if_wg.c   Mon Aug 31 20:26:21 2020 +0000
+++ b/sys/net/if_wg.c   Mon Aug 31 20:26:46 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wg.c,v 1.42 2020/08/31 20:26:21 riastradh Exp $     */
+/*     $NetBSD: if_wg.c,v 1.43 2020/08/31 20:26:46 riastradh Exp $     */
 
 /*
  * Copyright (C) Ryota Ozaki <ozaki.ryota%gmail.com@localhost>
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.42 2020/08/31 20:26:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.43 2020/08/31 20:26:46 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1329,7 +1329,6 @@
        uint8_t peer_pubkey[WG_STATIC_KEY_LEN];
        struct wg_peer *wgp;
        struct wg_session *wgs;
-       bool reset_state_on_error = false;
        int error, ret;
        struct psref psref_peer;
        struct psref psref_session;
@@ -1409,7 +1408,6 @@
                wg_clear_states(wgs);
        }
        wgs->wgs_state = WGS_STATE_INIT_PASSIVE;
-       reset_state_on_error = true;
        wg_get_session(wgs, &psref_session);
        mutex_exit(wgs->wgs_lock);
 
@@ -1509,12 +1507,10 @@
        return;
 
 out:
-       if (reset_state_on_error) {
-               mutex_enter(wgs->wgs_lock);
-               KASSERT(wgs->wgs_state == WGS_STATE_INIT_PASSIVE);
-               wgs->wgs_state = WGS_STATE_UNKNOWN;
-               mutex_exit(wgs->wgs_lock);
-       }
+       mutex_enter(wgs->wgs_lock);
+       KASSERT(wgs->wgs_state == WGS_STATE_INIT_PASSIVE);
+       wgs->wgs_state = WGS_STATE_UNKNOWN;
+       mutex_exit(wgs->wgs_lock);
        wg_put_session(wgs, &psref_session);
 out_wgp:
        wg_put_peer(wgp, &psref_peer);



Home | Main Index | Thread Index | Old Index