diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2014-11-23 18:48:15 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-26 13:42:53 -0800 |
commit | 698f140d67e0a92b6d4606c67fdf42b3853c34b6 (patch) | |
tree | 302e74863e19fd293f6d249cafda621bd5551e22 /drivers/staging/android | |
parent | 74ed42c73d7b3819d2c80164840aa8f00be3975d (diff) | |
download | linux-stable-698f140d67e0a92b6d4606c67fdf42b3853c34b6.tar.gz linux-stable-698f140d67e0a92b6d4606c67fdf42b3853c34b6.tar.bz2 linux-stable-698f140d67e0a92b6d4606c67fdf42b3853c34b6.zip |
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>
Diffstat (limited to 'drivers/staging/android')
-rw-r--r-- | drivers/staging/android/ion/ion.c | 6 | ||||
-rw-r--r-- | drivers/staging/android/ion/ion_dummy_driver.c | 6 | ||||
-rw-r--r-- | drivers/staging/android/ion/tegra/tegra_ion.c | 6 |
3 files changed, 6 insertions, 12 deletions
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 8724ef89ce94..296d347660fc 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -263,8 +263,7 @@ err: 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); } diff --git a/drivers/staging/android/ion/ion_dummy_driver.c b/drivers/staging/android/ion/ion_dummy_driver.c index f3ea1c31e533..5678870bff48 100644 --- a/drivers/staging/android/ion/ion_dummy_driver.c +++ b/drivers/staging/android/ion/ion_dummy_driver.c @@ -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) { diff --git a/drivers/staging/android/ion/tegra/tegra_ion.c b/drivers/staging/android/ion/tegra/tegra_ion.c index 11c7cceb3c7d..5b8ef0e66010 100644 --- a/drivers/staging/android/ion/tegra/tegra_ion.c +++ b/drivers/staging/android/ion/tegra/tegra_ion.c @@ -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; } |