Skip to content

Commit

Permalink
dmaengine: fix balance of privatecnt inc/dec operations
Browse files Browse the repository at this point in the history
This patch increments privatecnt value and set DMA_PRIVATE in device
caps in dma_request_slave_channel() function. This is needed to keep
privatecnt increment/decrement balance.

As function dma_release_channel() decrements privatecnt counter, we need
to increment it when channel is requested. Otherwise privatecnt drops
into negatives after few dma_release_channel() calls.

Reported-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
  • Loading branch information
Robert Baldyga authored and Vinod Koul committed Aug 17, 2015
1 parent 2c6625c commit 05aa1a7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/dma/dmaengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,10 @@ struct dma_chan *dma_request_slave_channel(struct device *dev,
struct dma_chan *ch = dma_request_slave_channel_reason(dev, name);
if (IS_ERR(ch))
return NULL;

dma_cap_set(DMA_PRIVATE, ch->device->cap_mask);
ch->device->privatecnt++;

return ch;
}
EXPORT_SYMBOL_GPL(dma_request_slave_channel);
Expand Down

0 comments on commit 05aa1a7

Please sign in to comment.