Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2180896iof; Tue, 7 Jun 2022 22:23:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWlaa7bEstS7QLwZqLWnkk33fcuWXxhEIk5s5V7YqWofCBEdt88NX9MNczFnFs54dyu2C2 X-Received: by 2002:a17:902:f612:b0:14c:e978:f99e with SMTP id n18-20020a170902f61200b0014ce978f99emr32524351plg.23.1654665794472; Tue, 07 Jun 2022 22:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654665794; cv=none; d=google.com; s=arc-20160816; b=mIsomALlvqFU0WIe2fU71Q+E6o/aljuEYXQaDWdZztHElURbsTwxDtJznIRUxf5GNd cEiAvxTKNYoFy6LA2m8Iz4BQx6V3tf5bs8S/pHAFHx2Gow/dDefREn77goSIjcBGdDbK D82bau6IHp908I1E180V3ZhJ3ZF3H5pUJaYU2SryTu9zwn0E13CCmkpvCJRIRgiC5ydC bCjNV/5gXcVN2jv2wxCHFU414pR7FBoYug9xwtxNzz/2wZrr0CtbDkTeDoSlNK+OqBnK 1uTG1GV4e3MeKwNdFGaG6BkZt8J6xSpC6wRbKoDcdB6jkKGwg4xrdZ4ZKj/5FgcBw1Sr daWQ== 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=blgY5Wy0IUj4/rDUxASUUOwQvkLDJCkUIKmvkEY2FWA=; b=GYLxxNb4Kr6SUw+GPSyr7fdoqrk+yMHo7wQLHSALV6A3125+QGLOMs+jfBtM4v9KUY z1uG0NHbSUyZgRcqXdJ3PLfUEVfZ10hHC6iqT2q7vzGRqc8v7qz+5rxsi6elhWvYNk2L 84KXWR8GCvPtf1dIjgzYVNGOQ1C4Z0WgSKmF3E9IWdWYzi+VMRwlvfxf47l0/apnhkQG Tpnr9xEBt0h/TISLZuItfsOB9U84IodTucdosErAiQ89PETBdOiAwjKBM96xgNO9Ktcn wgBX19QGg6NJ/qlVjepv5jxIxHNe8CCPFLH7+mNX30BPw21hmHoGfUoF33Q19yJF0qJP z4Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rGjXHm6n; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 205-20020a6301d6000000b003fcee2c26b5si23370801pgb.399.2022.06.07.22.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:23:14 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rGjXHm6n; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AE84A149DAC; Tue, 7 Jun 2022 21:50:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382056AbiFGW3A (ORCPT + 99 others); Tue, 7 Jun 2022 18:29:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378548AbiFGVTD (ORCPT ); Tue, 7 Jun 2022 17:19:03 -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 72B1122445F; Tue, 7 Jun 2022 11:59:32 -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 454D0B82391; Tue, 7 Jun 2022 18:59:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ECD2C385A2; Tue, 7 Jun 2022 18:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628368; bh=1vuZle/aJdf8IXFfMGotKYrT8HQrM8syeDFZeWAjPJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rGjXHm6nnejWqetoI2wOM8iylv596oGQCU7tJnaMh/IzIEzfypoE2YjiA3lkj2rMq BcKDqe/cgsWtQpylbfnXTI9Rff3YvNAbspvF1vtr9pMGcUmMC/fadJR75QTJ7YfFbj i3hCxIBitbSC9N9s0bp6mp0oweRySMND9522kP2M= 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.18 304/879] spi: spi-ti-qspi: Fix return value handling of wait_for_completion_timeout Date: Tue, 7 Jun 2022 18:57:02 +0200 Message-Id: <20220607165011.673443006@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 e06aafe169e0..081da1fd3fd7 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c @@ -448,6 +448,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) { @@ -467,9 +468,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