Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358505
b: refs/heads/master
c: cbd6531
h: refs/heads/master
i:
  358503: e0be341
v: v3
  • Loading branch information
Andy Shevchenko authored and Vinod Koul committed Jan 9, 2013
1 parent 51882f2 commit 43879a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 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: 123de543414bce42da9729071962d4a9512612c8
refs/heads/master: cbd65312ba6b508e994d40729e84a51301870bcc
20 changes: 14 additions & 6 deletions trunk/drivers/dma/dw_dmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,7 @@ static int dwc_alloc_chan_resources(struct dma_chan *chan)
struct dw_desc *desc;
int i;
unsigned long flags;
int ret;

dev_vdbg(chan2dev(chan), "%s\n", __func__);

Expand All @@ -1110,19 +1111,19 @@ static int dwc_alloc_chan_resources(struct dma_chan *chan)
spin_unlock_irqrestore(&dwc->lock, flags);

desc = kzalloc(sizeof(struct dw_desc), GFP_KERNEL);
if (!desc) {
dev_info(chan2dev(chan),
"only allocated %d descriptors\n", i);
spin_lock_irqsave(&dwc->lock, flags);
break;
}
if (!desc)
goto err_desc_alloc;

INIT_LIST_HEAD(&desc->tx_list);
dma_async_tx_descriptor_init(&desc->txd, chan);
desc->txd.tx_submit = dwc_tx_submit;
desc->txd.flags = DMA_CTRL_ACK;
desc->txd.phys = dma_map_single(chan2parent(chan), &desc->lli,
sizeof(desc->lli), DMA_TO_DEVICE);
ret = dma_mapping_error(chan2parent(chan), desc->txd.phys);
if (ret)
goto err_desc_alloc;

dwc_desc_put(dwc, desc);

spin_lock_irqsave(&dwc->lock, flags);
Expand All @@ -1133,6 +1134,13 @@ static int dwc_alloc_chan_resources(struct dma_chan *chan)

dev_dbg(chan2dev(chan), "%s: allocated %d descriptors\n", __func__, i);

return i;

err_desc_alloc:
kfree(desc);

dev_info(chan2dev(chan), "only allocated %d descriptors\n", i);

return i;
}

Expand Down

0 comments on commit 43879a3

Please sign in to comment.