Re: [PATCH v2 10/16] dmaengine: bcm-sba-raid: Alloc resources before registering DMA device

From
Anup Patel <hidden>
Date
2017-08-18 05:01:54
Also in
linux-arm-kernel, lkml
Reply to
Vinod Koul, 2017-08-17
On Thu, Aug 17, 2017 at 12:08 PM, Vinod Koul [off-list ref] wrote:
On Tue, Aug 01, 2017 at 04:07:54PM +0530, Anup Patel wrote:
quoted
We should allocate DMA channel resources before registering the
DMA device in sba_probe() because we can get DMA request soon
after registering the DMA device. If DMA channel resources are
not allocated before first DMA request then SBA-RAID driver will
crash.

Signed-off-by: Anup Patel <redacted>
---
 drivers/dma/bcm-sba-raid.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c
index f6616da..f14ed0a 100644
--- a/drivers/dma/bcm-sba-raid.c
+++ b/drivers/dma/bcm-sba-raid.c
@@ -1478,13 +1478,13 @@ static int sba_prealloc_channel_resources(struct sba_device *sba)
      int i, j, ret = 0;
      struct sba_request *req = NULL;

-     sba->resp_base = dma_alloc_coherent(sba->dma_dev.dev,
+     sba->resp_base = dma_alloc_coherent(sba->mbox_dev,
how does this qualify as move before registering, you seem to be using
different device now
The sba->dma_dev.dev is assigned in sba_async_register().

Now, if we are calling sba_async_register() after
sba_prealloc_channel_resources() then we cannot
use sba->dma_dev.dev in sba_prealloc_channel_resources()

Regards,
Anup
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thread (35 messages) 35 messages, 3 authors, last reply 2017-09-08
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help