From: Nicholas Mc Guire Date: Wed, 1 May 2019 14:38:12 +0000 (-0400) Subject: staging: fieldbus: anybus-s: fix wait_for_completion_timeout return handling X-Git-Tag: v5.4-rc1~1076^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e2e9cf9ee67086d9c43e03bd6041a9d1bce9473;p=platform%2Fkernel%2Flinux-rpi.git staging: fieldbus: anybus-s: fix wait_for_completion_timeout return handling wait_for_completion_timeout() returns unsigned long (0 on timeout or remaining jiffies) not int. Assigning this return value to int may theoretically overflow (though not in this case where TIMEOUT is only HZ*2). Fix this inconsistency by wrapping the wait_for_completion_timeout into the if(). Signed-off-by: Nicholas Mc Guire Reviewed-by: Sven Van Asbroeck Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/fieldbus/anybuss/host.c b/drivers/staging/fieldbus/anybuss/host.c index dc692f6..f69dc49 100644 --- a/drivers/staging/fieldbus/anybuss/host.c +++ b/drivers/staging/fieldbus/anybuss/host.c @@ -1325,11 +1325,10 @@ anybuss_host_common_probe(struct device *dev, * interrupt came in: ready to go ! */ reset_deassert(cd); - ret = wait_for_completion_timeout(&cd->card_boot, TIMEOUT); - if (ret == 0) + if (!wait_for_completion_timeout(&cd->card_boot, TIMEOUT)) { ret = -ETIMEDOUT; - if (ret < 0) goto err_reset; + } /* * according to the anybus docs, we're allowed to read these * without handshaking / reserving the area