]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: gasket: remove null ptr check before kfree
authorSumit Kumar <sumit686215@gmail.com>
Sun, 12 Aug 2018 07:08:19 +0000 (12:38 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Aug 2018 17:42:32 +0000 (19:42 +0200)
Remove null ptr check before kfree because kfree is null ptr safe.
Issue found by checkpatch.

Signed-off-by: Sumit Kumar <sumit686215@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gasket/gasket_page_table.c

index d4c5f8aa7dd34eb317a1c483a7295d813555e144..bd921dc6094de7e77a091b7593a2453977d4c2cf 100644 (file)
@@ -1328,10 +1328,8 @@ int gasket_alloc_coherent_memory(struct gasket_dev *gasket_dev, u64 size,
                                  num_pages * PAGE_SIZE, mem, handle);
        }
 
-       if (gasket_dev->page_table[index]->coherent_pages) {
-               kfree(gasket_dev->page_table[index]->coherent_pages);
-               gasket_dev->page_table[index]->coherent_pages = NULL;
-       }
+       kfree(gasket_dev->page_table[index]->coherent_pages);
+       gasket_dev->page_table[index]->coherent_pages = NULL;
        gasket_dev->page_table[index]->num_coherent_pages = 0;
        return -ENOMEM;
 }