Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp569227iog; Mon, 13 Jun 2022 08:18:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3xBkTSvkmrVfO05GsV9QSiAcICfD3JIzKdbJfd55tMKl/Xb+kBO2eqWy92Uw/Owm2AgGI X-Received: by 2002:a17:907:c1d:b0:70f:469a:3d73 with SMTP id ga29-20020a1709070c1d00b0070f469a3d73mr343728ejc.248.1655133534119; Mon, 13 Jun 2022 08:18:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655133534; cv=none; d=google.com; s=arc-20160816; b=QneFkhou4WHRTJWRN5cECpvfBLA5OrIBBFVFY3qlfwpq11YUvJaX2gMXQdrMvKLtiz CuC53Kac7ngSSOIO5qSKrMu22RTAnhifei31Lu0XH+n3DYthw9dLKCW3vBDJVPM6TGUH nYdHiAJA+3PJZ2Z67aIsGWsqfkA7aaL1IMKO56atQBAXJQVROUyYIyORhwYQoiFTA8dZ Q1vC8d7VklY5jmPKV+9l4ECOGIydKtz7Zpb6RJ3XkwM5sFs0PPzXhvV4MlILGODbHtIo AjWoKO8y7FA7wuCGf2JeqcdCOWqE3Eix/jVqhrqjV1apmLb/u5xQ1GU6+m1GBhR/l7p0 XtOQ== 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=OHkgxjGUhf/4rNChMqIpS8cLN7m/goH4mTdKb8Oj5fw=; b=o6ftc8t5AP+d8mHBdYYM3lxdJxlfWcQrN3cif4wSq49clfwxx/scsoQLS0oF/Jktwz uA8IreRCKO8vnWv7iJOXbjGG0qhVRZLZChR5RIDnJ9TWTYqMUfu+7fyaAAgJpLE27Kll SEE7/lLdl1zv366NRYEIjfHy+iAjkTIl8HWtB6yVXBGizsqFQpQMdOFHn4o8NIQQRNSl oIoThxE9YiHVRkdP2VYjt1pQWmh7L5YiYSVQgOgsmMcPVEPDUvznpLApzxq1ytLnr8Fu 9UCx/G5CAJcHjdaF2Dfmcgw6NYOOHKN1eOAvfqED8EvFof315JyEIAJxGcy6+fK2rlSN 7J/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a9OMCXbx; 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 eb7-20020a0564020d0700b0042dfc47a353si8872685edb.512.2022.06.13.08.18.29; Mon, 13 Jun 2022 08:18:54 -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=a9OMCXbx; 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 S1352344AbiFMLMH (ORCPT + 99 others); Mon, 13 Jun 2022 07:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352267AbiFMLJk (ORCPT ); Mon, 13 Jun 2022 07:09:40 -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 6C294340E1; Mon, 13 Jun 2022 03:35:37 -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 96C9160FF9; Mon, 13 Jun 2022 10:35:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A20C3C3411E; Mon, 13 Jun 2022 10:35:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116536; bh=AfnVigUurQHPHyJFt6jtGZqAt1pK6t+7RGNgUZ6wszw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a9OMCXbxHLq6w/mT0P/vmN0E6nXW/gL/j+fuZT0zAW0ou9n0xEBrjijgekyoUCps5 u2kzH39lPY/ujevOA+YefPq6jDENgyPDfA0P/a3H939N2MOB/z569t81cZ2mSW85uU kxsr7rgxH5mtjcc8suQyb7oDawB15Gc+Zfjmxh34= 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 5.4 094/411] spi: spi-ti-qspi: Fix return value handling of wait_for_completion_timeout Date: Mon, 13 Jun 2022 12:06:07 +0200 Message-Id: <20220613094931.500153173@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@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 6b6ef8944283..4bbad00244ab 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c @@ -401,6 +401,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) { @@ -420,9 +421,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