Module Name:    src
Committed By:   riastradh
Date:           Mon Aug 31 20:26:46 UTC 2020

Modified Files:
        src/sys/net: if_wg.c

Log Message:
wg: Omit needless variable.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/net/if_wg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_wg.c
diff -u src/sys/net/if_wg.c:1.42 src/sys/net/if_wg.c:1.43
--- src/sys/net/if_wg.c:1.42	Mon Aug 31 20:26:21 2020
+++ src/sys/net/if_wg.c	Mon Aug 31 20:26:46 2020
@@ -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.ry...@gmail.com>
@@ -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 @@ wg_handle_msg_init(struct wg_softc *wg, 
 	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_handle_msg_init(struct wg_softc *wg, 
 		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 @@ wg_handle_msg_init(struct wg_softc *wg, 
 	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);

Reply via email to