aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolin Chen <nicoleotsuka@gmail.com>2014-06-15 23:32:29 -0400
committerVinod Koul <vinod.koul@intel.com>2014-07-25 04:40:24 -0400
commit0b3518652c596b00c1592b5adb2544db75b5ef57 (patch)
tree708e170f3140a93ec2a5fb9721b205b92107edeb
parentb1e51d771fbc9fec15785760a2f725040a0fe671 (diff)
dmaengine: imx-sdma: Save imx_dma_data into sdmac
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> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r--drivers/dma/imx-sdma.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index bbcf783707f1..8269c200b53b 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -271,6 +271,7 @@ struct sdma_channel {
271 unsigned int chn_count; 271 unsigned int chn_count;
272 unsigned int chn_real_count; 272 unsigned int chn_real_count;
273 struct tasklet_struct tasklet; 273 struct tasklet_struct tasklet;
274 struct imx_dma_data data;
274}; 275};
275 276
276#define IMX_DMA_SG_LOOP BIT(0) 277#define IMX_DMA_SG_LOOP BIT(0)
@@ -1413,12 +1414,14 @@ err_dma_alloc:
1413 1414
1414static bool sdma_filter_fn(struct dma_chan *chan, void *fn_param) 1415static bool sdma_filter_fn(struct dma_chan *chan, void *fn_param)
1415{ 1416{
1417 struct sdma_channel *sdmac = to_sdma_chan(chan);
1416 struct imx_dma_data *data = fn_param; 1418 struct imx_dma_data *data = fn_param;
1417 1419
1418 if (!imx_dma_is_general_purpose(chan)) 1420 if (!imx_dma_is_general_purpose(chan))
1419 return false; 1421 return false;
1420 1422
1421 chan->private = data; 1423 sdmac->data = *data;
1424 chan->private = &sdmac->data;
1422 1425
1423 return true; 1426 return true;
1424} 1427}