All of lore.kernel.org
 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 3/3] dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure
Date: Wed, 17 Aug 2022 11:41:25 +0530	[thread overview]
Message-ID: <20220817061125.4720-4-swati.agarwal@xilinx.com> (raw)
In-Reply-To: <20220817061125.4720-1-swati.agarwal@xilinx.com>

The driver does not handle the failure case while calling
dma_set_mask_and_coherent API.

In case of failure, capture the return value of API and then report an
error.

Addresses-coverity: Unchecked return value (CHECKED_RETURN)

Signed-off-by: Swati Agarwal <swati.agarwal@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
---
 drivers/dma/xilinx/xilinx_dma.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index f63ec9d862ff..7ce8bb160a59 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -3211,7 +3211,11 @@ static int xilinx_dma_probe(struct platform_device *pdev)
 		xdev->ext_addr = false;
 
 	/* Set the dma mask bits */
-	dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width));
+	err = dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width));
+	if (err < 0) {
+		dev_err(xdev->dev, "DMA mask error %d\n", err);
+		goto disable_clks;
+	}
 
 	/* Initialize the DMA engine */
 	xdev->common.dev = &pdev->dev;
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
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 3/3] dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure
Date: Wed, 17 Aug 2022 11:41:25 +0530	[thread overview]
Message-ID: <20220817061125.4720-4-swati.agarwal@xilinx.com> (raw)
In-Reply-To: <20220817061125.4720-1-swati.agarwal@xilinx.com>

The driver does not handle the failure case while calling
dma_set_mask_and_coherent API.

In case of failure, capture the return value of API and then report an
error.

Addresses-coverity: Unchecked return value (CHECKED_RETURN)

Signed-off-by: Swati Agarwal <swati.agarwal@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
---
 drivers/dma/xilinx/xilinx_dma.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index f63ec9d862ff..7ce8bb160a59 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -3211,7 +3211,11 @@ static int xilinx_dma_probe(struct platform_device *pdev)
 		xdev->ext_addr = false;
 
 	/* Set the dma mask bits */
-	dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width));
+	err = dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width));
+	if (err < 0) {
+		dev_err(xdev->dev, "DMA mask error %d\n", err);
+		goto disable_clks;
+	}
 
 	/* Initialize the DMA engine */
 	xdev->common.dev = &pdev->dev;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

Thread overview: 10+ 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
2022-08-17  6:11 ` [PATCH v2 1/3] dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error handling Swati Agarwal
2022-08-17  6:11   ` Swati Agarwal
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   ` Swati Agarwal
2022-08-17  6:11 ` Swati Agarwal [this message]
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
2022-09-04 17:24   ` 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-4-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.