Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1398596yba; Fri, 26 Apr 2019 21:36:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqyi8HtQfiFuwCaOyjR+ksBo3l0yO7J9Bjh3fGDUE6E0s6SNsZM5sxCbm2OHWUFbydCwOsOz X-Received: by 2002:a65:5cc8:: with SMTP id b8mr45703824pgt.36.1556339760549; Fri, 26 Apr 2019 21:36:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556339760; cv=none; d=google.com; s=arc-20160816; b=fNYkab2kavPcBDM6zVrcicwcQW1ex+H1RcQwCyK1esRubZChhSsqDQ4LYtgAbJJJAA Rcx3EJFywBwXpCVdd1f9PVMFLUJTUiqQmSrgnwMx61U+FmrgfI2wczk1mogS9aCCmZLi vcQd2stBlDy0kELLbKcKPx4W1HNEJAkbiXbMfraKyPFYY+TM1WY3wKFhOOfmq2HgKMeA BqLylh3IZO+GTFZPcMTWGS09rNLL0XK1qdB+pkF9UmpjXGQGEm5xEZGobLWkcrv9OxZz 8y7UI5D2VlbMDAZbfn+Asqa3+OvHe6TAGcejeJKYb046B7cpwX8Hcjs82gRZiFUngLKQ PAaQ== 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=1kBNDfgmn5h9h5MIOCMpj6xZk6sJKysopuTffTanoeY=; b=uXOk2wx/VJgL9Cfo9/EmO4iWlWXhgHCuNKNRSt3iP9CufGa5jeUDanBamsFrDFIpKp oPf4lcZqPUXnZ2KNioYbMWZpgcqzpDiNsrRogDTpQIA8whA8XZkNbTskVPGGj9yQn9Ie cIG3nnpuS5v9bXPgHH/HYLfxF8FN/OtlHavYD7ZlwxSrTyaaiOp+psp1IiDaXeM03STr 1avPm1M7y0Yl/nfATTgjS3euL5WEKvwa5TNa8Ye+S3UkVgOFHFYiv8h7LtIcJ7sv8oAr t/xgSGMZRXxj63OSuCzG5+sXFmHuAI/3JAYGD0vjGKdAO/CRV3GV1JMAQbQiVg3bbPU0 ib4A== 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 v2si1570478plo.167.2019.04.26.21.35.09; Fri, 26 Apr 2019 21:36:00 -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 S1726050AbfD0Ec3 (ORCPT + 99 others); Sat, 27 Apr 2019 00:32:29 -0400 Received: from www.osadl.org ([62.245.132.105]:38968 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbfD0Ec3 (ORCPT ); Sat, 27 Apr 2019 00:32:29 -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 x3R4WJYI018783; Sat, 27 Apr 2019 06:32:19 +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 RFC] staging: fieldbus: anybus-s: use proper type for wait_for_completion_timeout Date: Sat, 27 Apr 2019 06:26:48 +0200 Message-Id: <1556339208-7722-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. thus there is no negative case to check for here. Signed-off-by: Nicholas Mc Guire --- Problem located with experimental API conformance checking cocci script Q: It is not really clear if the proposed fix is the right thing here or if this should not be using wait_for_completion_interruptible - which would return -ERESTARTSYS on interruption. Someone that knows the details of this driver would need to check what condition should initiate the goto err_reset; which was actually unreachable in the current code. Patch was compile-tested with. x86_64_defconfig + FIELDBUS_DEV=m, HMS_ANYBUSS_BUS=m (some unrelated sparse warnings (cast to restricted __be16)) Patch is against 5.1-rc6 (localversion-next is next-20190426) drivers/staging/fieldbus/anybuss/host.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/fieldbus/anybuss/host.c b/drivers/staging/fieldbus/anybuss/host.c index e34d424..c52d715 100644 --- a/drivers/staging/fieldbus/anybuss/host.c +++ b/drivers/staging/fieldbus/anybuss/host.c @@ -1263,6 +1263,7 @@ anybuss_host_common_probe(struct device *dev, const struct anybuss_ops *ops) { int ret, i; + unsigned long time_left; u8 val[4]; u16 fieldbus_type; struct anybuss_host *cd; @@ -1325,11 +1326,9 @@ 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) + time_left = wait_for_completion_timeout(&cd->card_boot, TIMEOUT); + if (time_left == 0) 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