staging: android: ion: Deletion of unnecessary checks before two function calls

The functions ion_heap_destroy() and vfree() perform also input
parameter validation. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Markus Elfring 2014-11-23 18:48:15 +01:00 committed by Greg Kroah-Hartman
parent 74ed42c73d
commit 698f140d67
3 changed files with 6 additions and 12 deletions

View File

@ -263,8 +263,7 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
heap->ops->unmap_dma(heap, buffer);
heap->ops->free(buffer);
err1:
if (buffer->pages)
vfree(buffer->pages);
vfree(buffer->pages);
err2:
kfree(buffer);
return ERR_PTR(ret);
@ -276,8 +275,7 @@ void ion_buffer_destroy(struct ion_buffer *buffer)
buffer->heap->ops->unmap_kernel(buffer->heap, buffer);
buffer->heap->ops->unmap_dma(buffer->heap, buffer);
buffer->heap->ops->free(buffer);
if (buffer->pages)
vfree(buffer->pages);
vfree(buffer->pages);
kfree(buffer);
}

View File

@ -112,10 +112,8 @@ static int __init ion_dummy_init(void)
}
return 0;
err:
for (i = 0; i < dummy_ion_pdata.nr; i++) {
if (heaps[i])
ion_heap_destroy(heaps[i]);
}
for (i = 0; i < dummy_ion_pdata.nr; ++i)
ion_heap_destroy(heaps[i]);
kfree(heaps);
if (carveout_ptr) {

View File

@ -54,10 +54,8 @@ static int tegra_ion_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, idev);
return 0;
err:
for (i = 0; i < num_heaps; i++) {
if (heaps[i])
ion_heap_destroy(heaps[i]);
}
for (i = 0; i < num_heaps; ++i)
ion_heap_destroy(heaps[i]);
return err;
}