Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5588039imm; Mon, 23 Jul 2018 02:22:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdHwOtsLRHkWQIoXdlaVa73r4MkaBHMTblkXAzGvRObs6vNey3GtGu6T+KlErlEPqpzfUjm X-Received: by 2002:a63:e318:: with SMTP id f24-v6mr11154283pgh.175.1532337744247; Mon, 23 Jul 2018 02:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532337744; cv=none; d=google.com; s=arc-20160816; b=Kyr/srnFWoYFiarbcVL8i2FQFSrQAOk1RnUxkl61Kz7q5Srz4FjHx3fc9mEyc7qPXR Bgid7ev1T6MWasoOZ9gG3wNJBAswBP7YdwFVwHmnl14LWxPuqtsv+njfgPYyxBHr9Ycs HY8Yr7qpJZYRZq/PnffmlSSdyLmHaK7epsc2vhlWdRLluW8LuH1BP5tCubRMEA/FDeuO ncN+XNVUnA2XInbu++mQyqchq2bofmKEITXBIaaW9ZZzUbwstSJXfWz2Q3PE8J7h4hFS Db/lz/VHHmCiZ6nuzjFO8Qba05IoysvhPVEKBfijb32D9w1AzBLNCJQ/DoobcwoZNDH8 xElQ== 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 :arc-authentication-results; bh=eZGlDLLV7ejfdjslOGmfBdlRTbanQHMUGaa6+bJa4XI=; b=GlJKNm+VKXaFYiPJ3rKBW9gfGHWu6648sFzaiMAZacrrXAJVf/VpOvxk0u+i+OcCnQ rDKOs3cw5DIWkUzs1YXHe7MtlwsQtUNOLMNUvZliBCeEmh29STu9lXwUL3ZjzNfC32dN Jgn9Spe22y3mhrWZtAyPYYL4G8P0eV2pP/tGsaT8h8Ehz6S2Gtz3awZMuQsqhja/Bce9 3d1RFm56cMZcILSoTkOMfk1E3jjAq0cMq67YgyDmuPqP2YvU5rtgfuMj3fK4uEWOxsIv gNqAAeTSiptQr56kZi2OBBDGDwL2Mo7Ee2gip+nuDbDMZpGA8ETEi30LWwBnFRg4qnaV WaCA== 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 p7-v6si8298036pgp.70.2018.07.23.02.22.09; Mon, 23 Jul 2018 02:22:24 -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 S2388123AbeGWKVd (ORCPT + 99 others); Mon, 23 Jul 2018 06:21:33 -0400 Received: from www.osadl.org ([62.245.132.105]:41552 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388040AbeGWKVc (ORCPT ); Mon, 23 Jul 2018 06:21:32 -0400 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id w6N9JV11016475; Mon, 23 Jul 2018 11:19:31 +0200 From: Nicholas Mc Guire To: Lars-Peter Clausen Cc: Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] iio: ad_sigma_delta: use unsigned long for timeout Date: Mon, 23 Jul 2018 11:18:38 +0200 Message-Id: <1532337518-30085-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-4.2 required=6.0 tests=BAYES_00,RCVD_IN_DNSWL_MED 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 not int so an appropriate variable is declared and the assignment and check fixed up. Signed-off-by: Nicholas Mc Guire --- found by experimental coccinelle script As the timeout returned is always << INT_MAX there is no side-effect with the type conversion here, never the less proper types should be used. Patch was compile tested with: x86_64_defconfig + CONFIG_SPI=y, CONFIG_IIO=y, CONFIG_AD7793=y (implies CONFIG_AD_SIGMA_DELTA=y) Patch is against 4.18-rc5 (localversion-next is next-20180720) drivers/iio/adc/ad_sigma_delta.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c index cf1b048..fc95107 100644 --- a/drivers/iio/adc/ad_sigma_delta.c +++ b/drivers/iio/adc/ad_sigma_delta.c @@ -209,6 +209,7 @@ static int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, unsigned int mode, unsigned int channel) { int ret; + unsigned long timeout; ret = ad_sigma_delta_set_channel(sigma_delta, channel); if (ret) @@ -224,8 +225,8 @@ static int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, sigma_delta->irq_dis = false; enable_irq(sigma_delta->spi->irq); - ret = wait_for_completion_timeout(&sigma_delta->completion, 2*HZ); - if (ret == 0) { + timeout = wait_for_completion_timeout(&sigma_delta->completion, 2 * HZ); + if (timeout == 0) { sigma_delta->irq_dis = true; disable_irq_nosync(sigma_delta->spi->irq); ret = -EIO; -- 2.1.4