summaryrefslogtreecommitdiffhomepage
path: root/src/device.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-12-08 12:09:54 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-12-09 21:31:11 +0100
commitcf167e019d88cd0e78858b8cf2cc6c8c32435594 (patch)
tree964dd477ce1f561d0acfbf3eec34f6eee1c35367 /src/device.c
parentcce023cbd496c466f35a3d5a20730d8b210ef0c1 (diff)
device: traditional if is cleaner than switch for this small
This also generates identical assembly. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/device.c b/src/device.c
index efa2ee8..1504169 100644
--- a/src/device.c
+++ b/src/device.c
@@ -68,9 +68,7 @@ static int clear_noise_peer(struct wireguard_peer *peer, void *data)
static int suspending_clear_noise_peers(struct notifier_block *nb, unsigned long action, void *data)
{
struct wireguard_device *wg = container_of(nb, struct wireguard_device, clear_peers_on_suspend);
- switch (action) {
- case PM_HIBERNATION_PREPARE:
- case PM_SUSPEND_PREPARE:
+ if (action == PM_HIBERNATION_PREPARE || action == PM_SUSPEND_PREPARE) {
peer_for_each(wg, clear_noise_peer, NULL);
rcu_barrier();
}