Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2274902yba; Sat, 27 Apr 2019 19:41:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyavk461+rvmuunFMYoRyy4RVSr5KVX6yDk9WS9hH5awk6SFxA6uwv0lUAVt6vTOoWLEkov X-Received: by 2002:a63:1b11:: with SMTP id b17mr12852359pgb.207.1556419301931; Sat, 27 Apr 2019 19:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556419301; cv=none; d=google.com; s=arc-20160816; b=PTNU28V8YF3pPCPZ+nxzRwKkRVIKE77jpF7J7cBRqNthxr3v7BCLPeTXSVPO+joV8G g+p1KIa605fKkFETTTIUnFSZoOyR4fyiRR0gtpGvVfWHp8+8qa9jntu7S/XqG20CIqbE EvsMLOLRREzHNJS5a8pcWHQhkmMX8SXl1McjFc+I5RUXT9Z29YCw8z8767VaIm4VX3nh ZLb+Jjmm3LPKW6gL7S0oLyqrmgMrmr2VXeDO4r2IJAPXDP3eF1Cj01aqepQK4eJIa5lB YgTpp3lH3OVZKrZsukNGBRwC8b9yF8KP+qfs7DF4Ms4N4Y6RpiKhP9WoWkOReJqfX+Bh /M+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=PVRYRS9gj504Bp9ifjEg/P3oUprc+3KMrMJ5zJnyMp0=; b=Xz/oNRSGfm/y+oNNzo7Q6HPOMOzdts8GqFzQ1XhOmXOxKeLau4kLKGdUjW+Y1cz9Uh fDR/T0n+GDO5tNF5ZMx0LPCOuq05bDKs3a+5uXIh7iLMtEZhTnLUVX5vvktyJ21E8uaz GuSyfky33RtvT9ebeeELdah7Gie+oj6tXhfY1GT7DglPbQSIEoGXYwDdCaJXvoZ1olYY /M0wLrFsKUY+RDbRnf3mJXg5ta6jVZy42Qbe4l/etvUyejzolU7rJqyB8nWoiL4Yx6sz JWOamkX+A/26dkFkS1+TDbyn4VZOzswtScs7hoNPQl0nAXN7uVzJY8ru1cC5lXG3SJcQ sZjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bc4si29151759plb.246.2019.04.27.19.41.24; Sat, 27 Apr 2019 19:41:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726328AbfD1CjR (ORCPT + 99 others); Sat, 27 Apr 2019 22:39:17 -0400 Received: from www.osadl.org ([62.245.132.105]:55276 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726004AbfD1CjR (ORCPT ); Sat, 27 Apr 2019 22:39:17 -0400 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id x3S2cubg028251; Sun, 28 Apr 2019 04:38:56 +0200 From: Nicholas Mc Guire To: Greg Kroah-Hartman Cc: Sven Van Asbroeck , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH V2] staging: fieldbus: anybus-s: consolidate wait_for_completion_timeout return handling Date: Sun, 28 Apr 2019 04:33:23 +0200 Message-Id: <1556418804-10266-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org wait_for_completion_timeout() returns unsigned long (0 on timeout or remaining jiffies) not int - so rather than introducing an additional variable simply wrap the completion into an if(). Signed-off-by: Nicholas Mc Guire --- Problem located with experimental API conformance checking cocci script V2: The original patch's logic was wrong as it was skipping the fall-through if so using the fix proposed by Sven Van Asbroeck - This solution also eliminates the need to introduce an additional variable - Thanks ! Patch was compile-tested with. x86_64_defconfig + FIELDBUS_DEV=m, HMS_ANYBUSS_BUS=m (with an unrelated sparse warnings (cast to restricted __be16)) Patch is against 5.1-rc6 (localversion-next is next-20190426) drivers/staging/fieldbus/anybuss/host.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/fieldbus/anybuss/host.c b/drivers/staging/fieldbus/anybuss/host.c index e34d424..6227daf 100644 --- a/drivers/staging/fieldbus/anybuss/host.c +++ b/drivers/staging/fieldbus/anybuss/host.c @@ -1325,11 +1325,11 @@ 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 -- 2.1.4