forked from MIrrors/gasket-driver
staging: gasket: page table: remove dead code in coherent mem alloc
gasket_alloc_coherent_memory() has some unnecessary code related to out of memory checking that will never hit the condition checked, remove. Change-Id: Ifb09e7ff31d8ae41a486639a2abc6ce26c4d85ef Signed-off-by: Todd Poynor <toddpoynor@google.com>
This commit is contained in:
@@ -1299,7 +1299,6 @@ int gasket_alloc_coherent_memory(struct gasket_dev *gasket_dev, u64 size,
|
|||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!gasket_dev->page_table[index]->coherent_pages)
|
if (!gasket_dev->page_table[index]->coherent_pages)
|
||||||
goto nomem;
|
goto nomem;
|
||||||
*dma_address = 0;
|
|
||||||
|
|
||||||
gasket_dev->coherent_buffer.length_bytes =
|
gasket_dev->coherent_buffer.length_bytes =
|
||||||
PAGE_SIZE * (num_pages);
|
PAGE_SIZE * (num_pages);
|
||||||
@@ -1314,15 +1313,12 @@ int gasket_alloc_coherent_memory(struct gasket_dev *gasket_dev, u64 size,
|
|||||||
(dma_addr_t)mem + j * PAGE_SIZE;
|
(dma_addr_t)mem + j * PAGE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*dma_address == 0)
|
|
||||||
goto nomem;
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
nomem:
|
nomem:
|
||||||
if (mem) {
|
if (mem)
|
||||||
dma_free_coherent(gasket_get_device(gasket_dev),
|
dma_free_coherent(gasket_get_device(gasket_dev),
|
||||||
num_pages * PAGE_SIZE, mem, handle);
|
num_pages * PAGE_SIZE, mem, handle);
|
||||||
}
|
|
||||||
|
|
||||||
kfree(gasket_dev->page_table[index]->coherent_pages);
|
kfree(gasket_dev->page_table[index]->coherent_pages);
|
||||||
gasket_dev->page_table[index]->coherent_pages = NULL;
|
gasket_dev->page_table[index]->coherent_pages = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user