mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Swati Agarwal <swati.agarwal@xilinx.com>
To: <vkoul@kernel.org>, <lars@metafoo.de>, <adrianml@alumnos.upm.es>,
	<libaokun1@huawei.com>, <marex@denx.de>
Cc: <dmaengine@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <swati.agarwal@xilinx.com>,
	<harini.katakam@xilinx.com>, <radhey.shyam.pandey@xilinx.com>,
	<michal.simek@xilinx.com>, <swati.agarwal@amd.com>,
	<harini.katakam@amd.com>, <radhey.shyam.pandey@amd.com>,
	<michal.simek@amd.com>
Subject: [PATCH v2 1/3] dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error handling
Date: Wed, 17 Aug 2022 11:41:23 +0530	[thread overview]
Message-ID: <20220817061125.4720-2-swati.agarwal@xilinx.com> (raw)
In-Reply-To: <20220817061125.4720-1-swati.agarwal@xilinx.com>

Add missing cleanup in devm_platform_ioremap_resource().
When probe fails remove dma channel resources and disable clocks in
accordance with the order of resources allocated .

Signed-off-by: Swati Agarwal <swati.agarwal@xilinx.com>
---
 drivers/dma/xilinx/xilinx_dma.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index cd62bbb50e8b..ba0dccaa8cf1 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -3160,9 +3160,10 @@ static int xilinx_dma_probe(struct platform_device *pdev)
 
 	/* Request and map I/O memory */
 	xdev->regs = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(xdev->regs))
-		return PTR_ERR(xdev->regs);
-
+	if (IS_ERR(xdev->regs)) {
+		err = PTR_ERR(xdev->regs);
+		goto disable_clks;
+	}
 	/* Retrieve the DMA engine properties from the device tree */
 	xdev->max_buffer_len = GENMASK(XILINX_DMA_MAX_TRANS_LEN_MAX - 1, 0);
 	xdev->s2mm_chan_id = xdev->dma_config->max_channels / 2;
@@ -3259,7 +3260,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
 	for_each_child_of_node(node, child) {
 		err = xilinx_dma_child_probe(xdev, child);
 		if (err < 0)
-			goto disable_clks;
+			goto error;
 	}
 
 	if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) {
@@ -3294,12 +3295,12 @@ static int xilinx_dma_probe(struct platform_device *pdev)
 
 	return 0;
 
-disable_clks:
-	xdma_disable_allclks(xdev);
 error:
 	for (i = 0; i < xdev->dma_config->max_channels; i++)
 		if (xdev->chan[i])
 			xilinx_dma_chan_remove(xdev->chan[i]);
+disable_clks:
+	xdma_disable_allclks(xdev);
 
 	return err;
 }
-- 
2.17.1


  reply	other threads:[~2022-08-17  6:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17  6:11 [PATCH v2 0/3] dmaengine : xilinx_dma: Fix error handling paths Swati Agarwal
2022-08-17  6:11 ` Swati Agarwal [this message]
2022-08-17  6:11 ` [PATCH v2 2/3] dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property Swati Agarwal
2022-08-17  6:11 ` [PATCH v2 3/3] dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure Swati Agarwal
2022-09-04 17:24 ` [PATCH v2 0/3] dmaengine : xilinx_dma: Fix error handling paths Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220817061125.4720-2-swati.agarwal@xilinx.com \
    --to=swati.agarwal@xilinx.com \
    --cc=adrianml@alumnos.upm.es \
    --cc=dmaengine@vger.kernel.org \
    --cc=harini.katakam@amd.com \
    --cc=harini.katakam@xilinx.com \
    --cc=lars@metafoo.de \
    --cc=libaokun1@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=michal.simek@amd.com \
    --cc=michal.simek@xilinx.com \
    --cc=radhey.shyam.pandey@amd.com \
    --cc=radhey.shyam.pandey@xilinx.com \
    --cc=swati.agarwal@amd.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®