From c4c4c4f1e2552cf6fe486bd82aa4c3a5e1d0ae98 Mon Sep 17 00:00:00 2001 From: Gidon Studinski Date: Thu, 5 Dec 2019 18:21:18 +0200 Subject: [PATCH] wigig_sensing: fix usage of wait_event_interruptible_timeout() wait_event_interruptable_timeout() returns a positive number in a success case. This positive number needs to be set to 0 so that the calling function recognizes it as a success. Change-Id: Ic8565f95976f98682334da84d950257d43d6a320 Signed-off-by: Gidon Studinski Signed-off-by: Alexei Avshalom Lazar --- drivers/misc/wigig_sensing.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/misc/wigig_sensing.c b/drivers/misc/wigig_sensing.c index f2bd56539df9..c1af5a164eb4 100644 --- a/drivers/misc/wigig_sensing.c +++ b/drivers/misc/wigig_sensing.c @@ -563,12 +563,14 @@ static int wigig_sensing_ioc_change_mode(struct wigig_sensing_ctx *ctx, pr_err("wait_event_interruptible_timeout() interrupted by a signal (%d)\n", rc); goto End; - } - if (rc == 0) { + } else if (rc == 0) { /* Timeout, FW did not respond in time */ pr_err("wait_event_interruptible_timeout() timed out\n"); rc = -ETIME; goto End; + } else { + /* rc > 0, this is fine, set rc to 0 */ + rc = 0; } if (ctx->stm.state != ctx->stm.state_request) {