diff --git a/net/wireguard/compat/compat.h b/net/wireguard/compat/compat.h index a549927ddeeb..8e47d4c4a296 100644 --- a/net/wireguard/compat/compat.h +++ b/net/wireguard/compat/compat.h @@ -316,35 +316,6 @@ static inline void rng_is_initialized_callback(struct random_ready_callback *cb) atomic_set(rdy->rng_state, 2); kfree(rdy); } -static inline bool rng_is_initialized(void) -{ - static atomic_t rng_state = ATOMIC_INIT(0); - - if (atomic_read(&rng_state) == 2) - return true; - - if (atomic_cmpxchg(&rng_state, 0, 1) == 0) { - int ret; - struct rng_is_initialized_callback *rdy = kmalloc(sizeof(*rdy), GFP_ATOMIC); - if (!rdy) { - atomic_set(&rng_state, 0); - return false; - } - rdy->cb.owner = THIS_MODULE; - rdy->cb.func = rng_is_initialized_callback; - rdy->rng_state = &rng_state; - ret = add_random_ready_callback(&rdy->cb); - if (ret) - kfree(rdy); - if (ret == -EALREADY) { - atomic_set(&rng_state, 2); - return true; - } else if (ret) - atomic_set(&rng_state, 0); - return false; - } - return false; -} #elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) /* This is a disaster. Without this API, we really have no way of * knowing if it's initialized. We just return that it has and hope