Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp625940iog; Mon, 13 Jun 2022 09:23:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9RqauKpAKpWPSQGcC0d1UcqdGNBPjuUr4RpElcMCc47TeCzPwI0E8xSO9xkxwIyovO9AC X-Received: by 2002:a17:90b:38c1:b0:1e8:5df7:cfd8 with SMTP id nn1-20020a17090b38c100b001e85df7cfd8mr16549799pjb.79.1655137419554; Mon, 13 Jun 2022 09:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655137419; cv=none; d=google.com; s=arc-20160816; b=ICL9K9O2QMaV9ejPb+QldgxZBx1QGiu/AjceKPujNqUwCR6OVlOIYUwPI+TnUx5sQr LygYkSzrn/mMfo8D7jisU9PFhVTRFQUtijLHmrfaGvynuFka6kQI2yWPK0kihBXq8jDr iPJYp89xczuI0yJ8ZUK8sPh14ZClY3soGR9HLmiBZBgS527d29x1uW1o3JquZvyXitsm 4jXw1PAXB9W7vDxKJ+0P1IaoVNgzeLNbduG58vVNK/WYfl0lNq1QTWuHrT++ra+iM6Q6 Cd4KspaLLQ0Xw+QqFndTzXjCLo0YCHSIIF7l3Qtx1P3GV/s3gxl/xGQtkopLYEf73Vdp ++DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VVvk8VXD7CfRTnve9bGrwsoyaKl55IPLfrMMMHHDPP8=; b=B3CrjobCVyJ2CorltI+ovBx6ugKtGgHFBLoIobNB9zRYP3yRSuWfPitVMEGRAM2hzu Zap/6dFtBov3egX03+edNqzGKVm6N6zAMAdql7sePs4MQ7G4RFAE1fg7eDKtyNA82w9t aKlPLHdMzWa7OuGkclCJaLE0RE284YOcCYF3yLwVSi+xMsuSMQDWGCuuavst1IRYvMmi S0eU+pvVnihYEPP/qa2o4uPtC4rZXah1DdclLhDNIjK5J/kpEgvlp5yzc3vpKUyGsnGL k2LMvSRE7NfCcO9ma7FjJo7cDNgp0DjAR6J1eU3zmbKpa/PlMS9hzjowjO8Q6JwQkHyQ 0M0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dZ1xn8Nq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i3-20020a17090a64c300b001e26550d25esi12391311pjm.142.2022.06.13.09.23.19; Mon, 13 Jun 2022 09:23:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dZ1xn8Nq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356593AbiFMM4z (ORCPT + 99 others); Mon, 13 Jun 2022 08:56:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357446AbiFMMyX (ORCPT ); Mon, 13 Jun 2022 08:54:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8A4165D22; Mon, 13 Jun 2022 04:13:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B8CE560B7C; Mon, 13 Jun 2022 11:13:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C942AC34114; Mon, 13 Jun 2022 11:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655118788; bh=p2xRm+9G+qjCSlFGrHTFKeqMTugLPxbgRQ/rMbsfVyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dZ1xn8NqsVonvktvGAQ1iZkAMx1xn7XKVV4dnWnjIQC/FaSTAXPZivxtn1j8uuV9l zwph58GyFcscbqyEmWYpWd2JnRL4sPGMxJN1JPNdSrtZpihTQfZ/5NytF4rFV4p4K0 xq6Org5h4eKu3QnaWAm2LiDx4E2xY5MD++wt32nQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Philippe Schenker , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.15 028/247] iio: adc: stmpe-adc: Fix wait_for_completion_timeout return value check Date: Mon, 13 Jun 2022 12:08:50 +0200 Message-Id: <20220613094923.789535183@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094922.843438024@linuxfoundation.org> References: <20220613094922.843438024@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaoqian Lin [ Upstream commit d345b23200bcdbd2bd3582213d738c258b77718f ] wait_for_completion_timeout() returns unsigned long not long. it returns 0 if timed out, and positive if completed. The check for <= 0 is ambiguous and should be == 0 here indicating timeout which is the only error case Fixes: e813dde6f833 ("iio: stmpe-adc: Use wait_for_completion_timeout") Signed-off-by: Miaoqian Lin Reviewed-by: Philippe Schenker Link: https://lore.kernel.org/r/20220412065150.14486-1-linmq006@gmail.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/stmpe-adc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c index fba659bfdb40..64305d9fa560 100644 --- a/drivers/iio/adc/stmpe-adc.c +++ b/drivers/iio/adc/stmpe-adc.c @@ -61,7 +61,7 @@ struct stmpe_adc { static int stmpe_read_voltage(struct stmpe_adc *info, struct iio_chan_spec const *chan, int *val) { - long ret; + unsigned long ret; mutex_lock(&info->lock); @@ -79,7 +79,7 @@ static int stmpe_read_voltage(struct stmpe_adc *info, ret = wait_for_completion_timeout(&info->completion, STMPE_ADC_TIMEOUT); - if (ret <= 0) { + if (ret == 0) { stmpe_reg_write(info->stmpe, STMPE_REG_ADC_INT_STA, STMPE_ADC_CH(info->channel)); mutex_unlock(&info->lock); @@ -96,7 +96,7 @@ static int stmpe_read_voltage(struct stmpe_adc *info, static int stmpe_read_temp(struct stmpe_adc *info, struct iio_chan_spec const *chan, int *val) { - long ret; + unsigned long ret; mutex_lock(&info->lock); @@ -114,7 +114,7 @@ static int stmpe_read_temp(struct stmpe_adc *info, ret = wait_for_completion_timeout(&info->completion, STMPE_ADC_TIMEOUT); - if (ret <= 0) { + if (ret == 0) { mutex_unlock(&info->lock); return -ETIMEDOUT; } -- 2.35.1