Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 145412
b: refs/heads/master
c: 2e077f8
h: refs/heads/master
v: v3
  • Loading branch information
Ira Snyder authored and Li Yang committed May 22, 2009
1 parent 69f81a4 commit 9864122
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 776c8943f2766f2819fafd88fdfbaf418ecd6e41
refs/heads/master: 2e077f8e8337e52eef3c39c24c31e103b11a0326
18 changes: 15 additions & 3 deletions trunk/drivers/dma/fsldma.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy(
{
struct fsl_dma_chan *fsl_chan;
struct fsl_desc_sw *first = NULL, *prev = NULL, *new;
struct list_head *list;
size_t copy;
LIST_HEAD(link_chain);

if (!chan)
return NULL;
Expand All @@ -480,7 +480,7 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy(
if (!new) {
dev_err(fsl_chan->dev,
"No free memory for link descriptor\n");
return NULL;
goto fail;
}
#ifdef FSL_DMA_LD_DEBUG
dev_dbg(fsl_chan->dev, "new link desc alloc %p\n", new);
Expand Down Expand Up @@ -515,7 +515,19 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy(
/* Set End-of-link to the last link descriptor of new list*/
set_ld_eol(fsl_chan, new);

return first ? &first->async_tx : NULL;
return &first->async_tx;

fail:
if (!first)
return NULL;

list = &first->async_tx.tx_list;
list_for_each_entry_safe_reverse(new, prev, list, node) {
list_del(&new->node);
dma_pool_free(fsl_chan->desc_pool, new, new->async_tx.phys);
}

return NULL;
}

/**
Expand Down

0 comments on commit 9864122

Please sign in to comment.