* [PATCH] dma: imx-sdma: Save imx_dma_data into sdmac
@ 2014-06-16 3:32 Nicolin Chen
2014-07-25 8:36 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Nicolin Chen @ 2014-06-16 3:32 UTC (permalink / raw)
To: vinod.koul, s.hauer; +Cc: dan.j.williams, linux-kernel, dmaengine
The filter() function is currently called by xlate() while it transfers
imx_dma_data as a local variable to the filter() but releases the data
right after returning a DMA channel pointer, which results chan->private
pointing an invalid memory space.
So this patch just stores the imx_dma_data into sdmac to make usre the
private pointer valid as long as the channel exists.
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
---
drivers/dma/imx-sdma.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 19041ce..fc04add 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -270,6 +270,7 @@ struct sdma_channel {
unsigned int chn_count;
unsigned int chn_real_count;
struct tasklet_struct tasklet;
+ struct imx_dma_data data;
};
#define IMX_DMA_SG_LOOP BIT(0)
@@ -1402,12 +1403,14 @@ err_dma_alloc:
static bool sdma_filter_fn(struct dma_chan *chan, void *fn_param)
{
+ struct sdma_channel *sdmac = to_sdma_chan(chan);
struct imx_dma_data *data = fn_param;
if (!imx_dma_is_general_purpose(chan))
return false;
- chan->private = data;
+ sdmac->data = *data;
+ chan->private = &sdmac->data;
return true;
}
--
1.8.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dma: imx-sdma: Save imx_dma_data into sdmac
2014-06-16 3:32 [PATCH] dma: imx-sdma: Save imx_dma_data into sdmac Nicolin Chen
@ 2014-07-25 8:36 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2014-07-25 8:36 UTC (permalink / raw)
To: Nicolin Chen; +Cc: s.hauer, dan.j.williams, linux-kernel, dmaengine
On Mon, Jun 16, 2014 at 11:32:29AM +0800, Nicolin Chen wrote:
> The filter() function is currently called by xlate() while it transfers
> imx_dma_data as a local variable to the filter() but releases the data
> right after returning a DMA channel pointer, which results chan->private
> pointing an invalid memory space.
>
> So this patch just stores the imx_dma_data into sdmac to make usre the
> private pointer valid as long as the channel exists.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-25 8:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-16 3:32 [PATCH] dma: imx-sdma: Save imx_dma_data into sdmac Nicolin Chen
2014-07-25 8:36 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox