* [PATCH v2 0/3] dmaengine : xilinx_dma: Fix error handling paths
@ 2022-08-17 6:11 ` Swati Agarwal
0 siblings, 0 replies; 10+ messages in thread
From: Swati Agarwal @ 2022-08-17 6:11 UTC (permalink / raw)
To: vkoul, lars, adrianml, libaokun1, marex
Cc: dmaengine, linux-arm-kernel, linux-kernel, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek
Fix Unchecked return value coverity warning.
Fix probe error cleanup.
v2: split probe cleanup patch into two patches.
Swati Agarwal (3):
dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error
handling
dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property
dmaengine: xilinx_dma: Report error in case of
dma_set_mask_and_coherent API failure
drivers/dma/xilinx/xilinx_dma.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 0/3] dmaengine : xilinx_dma: Fix error handling paths
@ 2022-08-17 6:11 ` Swati Agarwal
0 siblings, 0 replies; 10+ messages in thread
From: Swati Agarwal @ 2022-08-17 6:11 UTC (permalink / raw)
To: vkoul, lars, adrianml, libaokun1, marex
Cc: dmaengine, linux-arm-kernel, linux-kernel, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek
Fix Unchecked return value coverity warning.
Fix probe error cleanup.
v2: split probe cleanup patch into two patches.
Swati Agarwal (3):
dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error
handling
dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property
dmaengine: xilinx_dma: Report error in case of
dma_set_mask_and_coherent API failure
drivers/dma/xilinx/xilinx_dma.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/3] dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error handling
2022-08-17 6:11 ` Swati Agarwal
@ 2022-08-17 6:11 ` Swati Agarwal
-1 siblings, 0 replies; 10+ messages in thread
From: Swati Agarwal @ 2022-08-17 6:11 UTC (permalink / raw)
To: vkoul, lars, adrianml, libaokun1, marex
Cc: dmaengine, linux-arm-kernel, linux-kernel, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 1/3] dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error handling
@ 2022-08-17 6:11 ` Swati Agarwal
0 siblings, 0 replies; 10+ messages in thread
From: Swati Agarwal @ 2022-08-17 6:11 UTC (permalink / raw)
To: vkoul, lars, adrianml, libaokun1, marex
Cc: dmaengine, linux-arm-kernel, linux-kernel, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/3] dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property
2022-08-17 6:11 ` Swati Agarwal
@ 2022-08-17 6:11 ` Swati Agarwal
-1 siblings, 0 replies; 10+ messages in thread
From: Swati Agarwal @ 2022-08-17 6:11 UTC (permalink / raw)
To: vkoul, lars, adrianml, libaokun1, marex
Cc: dmaengine, linux-arm-kernel, linux-kernel, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek
Free the allocated resources for missing xlnx,num-fstores property.
Signed-off-by: Swati Agarwal <swati.agarwal@xilinx.com>
---
drivers/dma/xilinx/xilinx_dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index ba0dccaa8cf1..f63ec9d862ff 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -3191,7 +3191,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
if (err < 0) {
dev_err(xdev->dev,
"missing xlnx,num-fstores property\n");
- return err;
+ goto disable_clks;
}
err = of_property_read_u32(node, "xlnx,flush-fsync",
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/3] dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property
@ 2022-08-17 6:11 ` Swati Agarwal
0 siblings, 0 replies; 10+ messages in thread
From: Swati Agarwal @ 2022-08-17 6:11 UTC (permalink / raw)
To: vkoul, lars, adrianml, libaokun1, marex
Cc: dmaengine, linux-arm-kernel, linux-kernel, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek
Free the allocated resources for missing xlnx,num-fstores property.
Signed-off-by: Swati Agarwal <swati.agarwal@xilinx.com>
---
drivers/dma/xilinx/xilinx_dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index ba0dccaa8cf1..f63ec9d862ff 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -3191,7 +3191,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
if (err < 0) {
dev_err(xdev->dev,
"missing xlnx,num-fstores property\n");
- return err;
+ goto disable_clks;
}
err = of_property_read_u32(node, "xlnx,flush-fsync",
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/3] dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure
2022-08-17 6:11 ` Swati Agarwal
@ 2022-08-17 6:11 ` Swati Agarwal
-1 siblings, 0 replies; 10+ messages in thread
From: Swati Agarwal @ 2022-08-17 6:11 UTC (permalink / raw)
To: vkoul, lars, adrianml, libaokun1, marex
Cc: dmaengine, linux-arm-kernel, linux-kernel, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/3] dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure
@ 2022-08-17 6:11 ` Swati Agarwal
0 siblings, 0 replies; 10+ messages in thread
From: Swati Agarwal @ 2022-08-17 6:11 UTC (permalink / raw)
To: vkoul, lars, adrianml, libaokun1, marex
Cc: dmaengine, linux-arm-kernel, linux-kernel, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek, swati.agarwal,
harini.katakam, radhey.shyam.pandey, michal.simek
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/3] dmaengine : xilinx_dma: Fix error handling paths
2022-08-17 6:11 ` Swati Agarwal
@ 2022-09-04 17:24 ` Vinod Koul
-1 siblings, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2022-09-04 17:24 UTC (permalink / raw)
To: Swati Agarwal
Cc: lars, adrianml, libaokun1, marex, dmaengine, linux-arm-kernel,
linux-kernel, harini.katakam, radhey.shyam.pandey, michal.simek,
swati.agarwal, harini.katakam, radhey.shyam.pandey, michal.simek
On 17-08-22, 11:41, Swati Agarwal wrote:
> Fix Unchecked return value coverity warning.
> Fix probe error cleanup.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/3] dmaengine : xilinx_dma: Fix error handling paths
@ 2022-09-04 17:24 ` Vinod Koul
0 siblings, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2022-09-04 17:24 UTC (permalink / raw)
To: Swati Agarwal
Cc: lars, adrianml, libaokun1, marex, dmaengine, linux-arm-kernel,
linux-kernel, harini.katakam, radhey.shyam.pandey, michal.simek,
swati.agarwal, harini.katakam, radhey.shyam.pandey, michal.simek
On 17-08-22, 11:41, Swati Agarwal wrote:
> Fix Unchecked return value coverity warning.
> Fix probe error cleanup.
Applied, thanks
--
~Vinod
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-09-04 17:26 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v2 3/3] dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure Swati Agarwal
2022-08-17 6:11 ` 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
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.