From patchwork Tue Nov 3 20:35:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 316887 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA0BCC2D0A3 for ; Tue, 3 Nov 2020 21:33:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AEAF82236F for ; Tue, 3 Nov 2020 21:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604439235; bh=625CS+VVUcH2j+DlX50bWniL4e5cbojM1+nNSZ7KK1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WbN9fwegsrTn8Sq0c0L+Rz3jjoaA97ylVlTZjqDe1dK7DEVx7cZ4PWgo3F/nvGB98 7Pp9GduGGNjg6QzqRlw3BM/uU9CNoHM04xHb+SUu6lp/2J6PjFNIikt6oG6i35pA/t +9UMpt8YSskv1HBidhNuHMdPyCfNoWZ4TCXC+oe4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387785AbgKCVdy (ORCPT ); Tue, 3 Nov 2020 16:33:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:58730 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729971AbgKCU4p (ORCPT ); Tue, 3 Nov 2020 15:56:45 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6DC1320732; Tue, 3 Nov 2020 20:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437004; bh=625CS+VVUcH2j+DlX50bWniL4e5cbojM1+nNSZ7KK1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BtWTVWism9dSQ9hxcnhNQHfCn/2RPjBfyz3uL97IA+m8Io5ZB+rOJsy6+x7ir1CRG mUfmhuKZTqCiGSKCBWdBUyUxy4pJyEbBP5Erz9w6IcOqbLLjdNnBbioWgHRgBW7SqQ JbPDIkJ54WMfzpcOU2deYEeZy5suo1SwbSu9KVpM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Chunyan Zhang , Mark Brown Subject: [PATCH 5.4 104/214] spi: sprd: Release DMA channel also on probe deferral Date: Tue, 3 Nov 2020 21:35:52 +0100 Message-Id: <20201103203300.738353279@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Krzysztof Kozlowski commit 687a2e76186dcfa42f22c14b655c3fb159839e79 upstream. If dma_request_chan() for TX channel fails with EPROBE_DEFER, the RX channel would not be released and on next re-probe it would be requested second time. Fixes: 386119bc7be9 ("spi: sprd: spi: sprd: Add DMA mode support") Cc: Signed-off-by: Krzysztof Kozlowski Acked-by: Chunyan Zhang Link: https://lore.kernel.org/r/20200901152713.18629-1-krzk@kernel.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-sprd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/spi/spi-sprd.c +++ b/drivers/spi/spi-sprd.c @@ -563,11 +563,11 @@ static int sprd_spi_dma_request(struct s ss->dma.dma_chan[SPRD_SPI_TX] = dma_request_chan(ss->dev, "tx_chn"); if (IS_ERR_OR_NULL(ss->dma.dma_chan[SPRD_SPI_TX])) { + dma_release_channel(ss->dma.dma_chan[SPRD_SPI_RX]); if (PTR_ERR(ss->dma.dma_chan[SPRD_SPI_TX]) == -EPROBE_DEFER) return PTR_ERR(ss->dma.dma_chan[SPRD_SPI_TX]); dev_err(ss->dev, "request TX DMA channel failed!\n"); - dma_release_channel(ss->dma.dma_chan[SPRD_SPI_RX]); return PTR_ERR(ss->dma.dma_chan[SPRD_SPI_TX]); }