Skip to content

Commit cc77aa1

Browse files
committed
bcm2708_dma: don't access the newly assigned cookie after unlocking
Signed-off-by: Simon Arlott <sa.me.uk>
1 parent 305c0ec commit cc77aa1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/dma/bcm2708_dma.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ static dma_cookie_t bcm2708_dma_submit(struct dma_async_tx_descriptor *dmatx)
146146
struct bcm2708_dmatx *bcmtx = to_bcmtx(dmatx);
147147
struct bcm2708_dmachan *bcmchan = bcmtx->chan;
148148
unsigned long flags;
149+
dma_cookie_t cookie;
149150

150151
mutex_lock(&bcmchan->prep_lock);
151152
list_del(&bcmtx->list);
@@ -156,12 +157,12 @@ static dma_cookie_t bcm2708_dma_submit(struct dma_async_tx_descriptor *dmatx)
156157
bcm2708_dma_chain_cb(list_last_entry(&bcmchan->pending,
157158
struct bcm2708_dmatx, list), bcmtx);
158159
list_add_tail(&bcmtx->list, &bcmchan->pending);
159-
dma_cookie_assign(&bcmtx->dmatx);
160+
cookie = dma_cookie_assign(&bcmtx->dmatx);
160161
spin_unlock_irqrestore(&bcmchan->lock, flags);
161162

162163
dev_vdbg(bcmchan->dev, "%s: %d: %08x\n", __func__, bcmchan->id,
163-
bcmtx->dmatx.cookie);
164-
return bcmtx->dmatx.cookie;
164+
cookie);
165+
return cookie;
165166
}
166167

167168
static struct bcm2708_dmatx *bcm2708_dma_alloc_cb(struct bcm2708_dmatx *bcmtx,

0 commit comments

Comments
 (0)