Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2271738iof; Wed, 8 Jun 2022 01:03:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFV4JKST/Y+jzP6+HAO5OgvOTv4PDwfkR9hbeKJBkkeGlCaYpq0li7EyeKAoOKnXwMCh8N X-Received: by 2002:a63:cd04:0:b0:3fa:1e2e:9720 with SMTP id i4-20020a63cd04000000b003fa1e2e9720mr28553349pgg.179.1654675409889; Wed, 08 Jun 2022 01:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654675409; cv=none; d=google.com; s=arc-20160816; b=lgt5EaOd1i5M0JwfOmhAhm1PU+pITrPHANfnDMgzFt+XYU/CJ8crN4sNKrxyxu/8pW vDxyxg4S3fHYNrgkJkVt4XSfJJV8jtEOvCbZh55Ils7ZGIXZKxWrU5xUDefoXqARoQu5 4pSH6vhgx5dEPU8Oz5KRWgwGoVh8XqKovGLhX+6iPyVrfmpvLGNAJKD7nmjxwtP8//cj KfNEqBhYKv+IxNjW1768A4EDf6sDkC3r80AI4TFcFhnndpWltQqd4B5ykeDcCRp8Hgx9 mStM2IbpXX05fkBrO4yM1qDq6mLTIKG+dBw8zONXwB4r7+iaKLinqK4pbZz8GUpHd4hS uZGg== 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=Oy9zMYxQKMHNpj7fFK1wJ6SwDHiJD/0EAbDeWkEhE2CnJLtFXggR7X6J5Z1N8NK7/A tZWgefm9rovBdjzD2VFrmjlhuZ8c5ha7BwYLVJ6g52hdMoOn2J3VI/X88TYD/x1LVvPA d0yCCSKm9KY4IOjX1sURpIgRIq+LhSQ4Pi0nAaH1qKbEozrhvwnxIKQhPyh8Jm+htQFb UjxIHvtzGO1C/99QpfeGBoKXToCU4Y45pQFeoLH/MU2OAz5bhqBWmvMbJCjdYnaS8fLO V5aQPDP5rOsRVSkPHDd4pZQQy3aNVqw2CBaSs8yYRaO1Zl67mkYCiqLzxHSLzvR/35L0 mT2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eGu+foy4; 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 o5-20020a17090ac70500b001e271338f32si34509621pjt.178.2022.06.08.01.03.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:03:29 -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=eGu+foy4; 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 27F10203D26; Wed, 8 Jun 2022 00:32:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347682AbiFGRfn (ORCPT + 99 others); Tue, 7 Jun 2022 13:35:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346514AbiFGR2U (ORCPT ); Tue, 7 Jun 2022 13:28:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 094A71157CB; Tue, 7 Jun 2022 10:24:25 -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 A1D9D60906; Tue, 7 Jun 2022 17:24:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC335C385A5; Tue, 7 Jun 2022 17:24:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654622664; bh=1vuZle/aJdf8IXFfMGotKYrT8HQrM8syeDFZeWAjPJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eGu+foy4QfitlcHvl1N2W/rMnJk1x6L1xYtvmLlW9sqR+8sr562glPGpFomofbDbx ltjZ1rk6USCE1D/Ik0d+g+0lik8fXqzs4uxdRlEldICWp1wipE0scKofLbmovCSRrT pFP01huG+Onn/s5ZxZgNBaDDcgXitDOrY31MeyPo= 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.10 140/452] spi: spi-ti-qspi: Fix return value handling of wait_for_completion_timeout Date: Tue, 7 Jun 2022 18:59:57 +0200 Message-Id: <20220607164912.731402210@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@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