Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp631246iog; Mon, 13 Jun 2022 09:30:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXorSdK2+RzjdHzVLmZxtsuoT8EEpD+gG31HQgpQe7aSXpUVhseM3q4Ha6/OaxGVXHvjuo X-Received: by 2002:a05:6a00:ad0:b0:4e1:2d96:2ab0 with SMTP id c16-20020a056a000ad000b004e12d962ab0mr154460pfl.3.1655137831828; Mon, 13 Jun 2022 09:30:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655137831; cv=none; d=google.com; s=arc-20160816; b=OOhWYZwYRKrRK/PuoR2otKJc6w4y8InA4CTKp0R2Uzwl9lnSvHOz7LFd8nKTpcTcVH HyRfnQ0PHoe3N4VPBGA5uI37KsDhxH+v67gIbQvzidFj6Qu4zFYFkoiO1sq0QN7eMpeC mJKTf+TNV0lMGByu/SnNTGjIXXMG6XDSaRPu7rWpLj69agewv9E+aRT4nmJPu5NjHrhi sVCF9v9SbG0qon9LmwN2R9JjPRgZpA3Zk3pgZxmajRnBIILKAKMPm9R/YBpsCin8o4pH Cdiy8MK7RWwN0uZKwILEvZLel4SRHFfwW95gl0KF1bL4G6onfn1Ioh+DxBw85MJH/oup uN3Q== 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=Fqw3qEv1OgOrx7swn3oJmCeyp4/cEMEwGXhyG0u4Gwc=; b=TXKVEgT+NILxwtcG+Co4dK5f5FO7RStrQUqVFS0BiLILdKM7KJKaxpI3aWfySLh6xV txhtHIeXGD5tePG6WYLfhWKpoiB5KzWs6SaVI/oIFrjv6ClMs9L+jNjsL6NxDFulDwYC dDukicK1uz/1jaLFmGTd2X4O5DHnOzl16zCl+Wch40R6I8hG7PyyBvhbBUQBM46lY5lX c0j1u4efDcATOvkdnxibg8rnrQfA5o5tAJ24e/nWD3tLI4ydz5dDGFueDINmhz4wlgMm m0iHw6R4+CcoB7SgLCWTyBmGp4qWPX4djcbunjly390zHFay7b3c/kwotRhyjENiDSY+ a21A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fXilopfD; 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 j5-20020aa79285000000b0051b4e546a3fsi8448210pfa.242.2022.06.13.09.30.19; Mon, 13 Jun 2022 09:30:31 -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=fXilopfD; 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 S244022AbiFMKow (ORCPT + 99 others); Mon, 13 Jun 2022 06:44:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345869AbiFMKlx (ORCPT ); Mon, 13 Jun 2022 06:41:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F2B82314D; Mon, 13 Jun 2022 03:24:04 -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 ams.source.kernel.org (Postfix) with ESMTPS id 5CB2AB80E90; Mon, 13 Jun 2022 10:24:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1907C34114; Mon, 13 Jun 2022 10:24:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655115842; bh=9GYc/5u8MFAyl/Ky7sHzrBM/HShJd5hQHgFPUL2MzGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fXilopfD8ALUj5uyE8K4RLjgKkajgMqNvE6evsgxJSQchD8MXpjsRuvNQY6tDVmKi 1ORQ0dldmOlc7gq/s2iiIv5g0lpxOmgZOftuNS1r0ZaoaGknW7jVKVAUebWUMxlAvX ehx2v+WNsmJAFJ1yyWO2RHV2SQ4n/CUmwWpARq+w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mark Brown , Sasha Levin Subject: [PATCH 4.14 053/218] spi: spi-ti-qspi: Fix return value handling of wait_for_completion_timeout Date: Mon, 13 Jun 2022 12:08:31 +0200 Message-Id: <20220613094920.753950320@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094908.257446132@linuxfoundation.org> References: <20220613094908.257446132@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 8b1ea69a63eb62f97cef63e6d816b64ed84e8760 ] wait_for_completion_timeout() returns unsigned long not int. 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: 5720ec0a6d26 ("spi: spi-ti-qspi: Add DMA support for QSPI mmap read") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220411111034.24447-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-ti-qspi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c index d9b02e7668ae..e5db20d11e3f 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c @@ -405,6 +405,7 @@ static int ti_qspi_dma_xfer(struct ti_qspi *qspi, dma_addr_t dma_dst, enum dma_ctrl_flags flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT; struct dma_async_tx_descriptor *tx; int ret; + unsigned long time_left; tx = dmaengine_prep_dma_memcpy(chan, dma_dst, dma_src, len, flags); if (!tx) { @@ -424,9 +425,9 @@ static int ti_qspi_dma_xfer(struct ti_qspi *qspi, dma_addr_t dma_dst, } dma_async_issue_pending(chan); - ret = wait_for_completion_timeout(&qspi->transfer_complete, + time_left = wait_for_completion_timeout(&qspi->transfer_complete, msecs_to_jiffies(len)); - if (ret <= 0) { + if (time_left == 0) { dmaengine_terminate_sync(chan); dev_err(qspi->dev, "DMA wait_for_completion_timeout\n"); return -ETIMEDOUT; -- 2.35.1