lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230313170450.897-2-jszhang@kernel.org>
Date:   Tue, 14 Mar 2023 01:04:40 +0800
From:   Jisheng Zhang <jszhang@...nel.org>
To:     Eugeniy Paltsev <Eugeniy.Paltsev@...opsys.com>,
        Vinod Koul <vkoul@...nel.org>
Cc:     dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 01/11] dmaengine: dw-axi-dmac: fix reading register hen runtime suspended

We should runtime resume the device before calling
axi_chan_is_hw_enable().

Signed-off-by: Jisheng Zhang <jszhang@...nel.org>
---
 drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
index 7f3a60e28e38..23a10dbdecb7 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -462,13 +462,17 @@ static void dw_axi_dma_synchronize(struct dma_chan *dchan)
 
 static int dma_chan_alloc_chan_resources(struct dma_chan *dchan)
 {
+	int ret;
 	struct axi_dma_chan *chan = dchan_to_axi_dma_chan(dchan);
 
+	pm_runtime_get(chan->chip->dev);
+
 	/* ASSERT: channel is idle */
 	if (axi_chan_is_hw_enable(chan)) {
 		dev_err(chan2dev(chan), "%s is non-idle!\n",
 			axi_chan_name(chan));
-		return -EBUSY;
+		ret = -EBUSY;
+		goto err_busy;
 	}
 
 	/* LLI address must be aligned to a 64-byte boundary */
@@ -478,13 +482,16 @@ static int dma_chan_alloc_chan_resources(struct dma_chan *dchan)
 					  64, 0);
 	if (!chan->desc_pool) {
 		dev_err(chan2dev(chan), "No memory for descriptors\n");
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto err_busy;
 	}
 	dev_vdbg(dchan2dev(dchan), "%s: allocating\n", axi_chan_name(chan));
 
-	pm_runtime_get(chan->chip->dev);
-
 	return 0;
+
+err_busy:
+	pm_runtime_put(chan->chip->dev);
+	return ret;
 }
 
 static void dma_chan_free_chan_resources(struct dma_chan *dchan)
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ