Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 205656
b: refs/heads/master
c: f932e3a
h: refs/heads/master
v: v3
  • Loading branch information
Marin Mitov authored and Greg Kroah-Hartman committed Jun 18, 2010
1 parent 01a71d9 commit 11c905e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 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: 616f58f6ec5e5777c343499ad65a34e671533e4b
refs/heads/master: f932e3a361731b403b1c2982197cea7e3d8e0e66
31 changes: 18 additions & 13 deletions trunk/drivers/staging/dt3155v4l/dt3155v4l.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,8 @@ struct dma_coherent_mem {
static int __devinit
dt3155_alloc_coherent(struct device *dev, size_t size, int flags)
{
struct dma_coherent_mem *mem;
dma_addr_t dev_base;
int pages = size >> PAGE_SHIFT;
int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long);

Expand All @@ -1018,25 +1020,28 @@ dt3155_alloc_coherent(struct device *dev, size_t size, int flags)
if (dev->dma_mem)
goto out;

dev->dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL);
if (!dev->dma_mem)
mem = kzalloc(sizeof(*mem), GFP_KERNEL);
if (!mem)
goto out;
dev->dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
if (!dev->dma_mem->bitmap)
mem->virt_base = dma_alloc_coherent(dev, size, &dev_base,
DT3155_COH_FLAGS);
if (!mem->virt_base)
goto err_alloc_coherent;
mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
if (!mem->bitmap)
goto err_bitmap;

dev->dma_mem->virt_base = dma_alloc_coherent(dev, size,
&dev->dma_mem->device_base, DT3155_COH_FLAGS);
if (!dev->dma_mem->virt_base)
goto err_coherent;
dev->dma_mem->size = pages;
dev->dma_mem->flags = flags;
/* coherent_dma_mask is already set to 32 bits */
mem->device_base = dev_base;
mem->size = pages;
mem->flags = flags;
dev->dma_mem = mem;
return DMA_MEMORY_MAP;

err_coherent:
kfree(dev->dma_mem->bitmap);
err_bitmap:
kfree(dev->dma_mem);
dma_free_coherent(dev, size, mem->virt_base, dev_base);
err_alloc_coherent:
kfree(mem);
out:
return 0;
}
Expand Down

0 comments on commit 11c905e

Please sign in to comment.