Remove null ptr check before kfree because kfree is null ptr safe.
Issue found by checkpatch.
Signed-off-by: Sumit Kumar <[email protected]>
---
drivers/staging/gasket/gasket_page_table.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/gasket/gasket_page_table.c b/drivers/staging/gasket/gasket_page_table.c
index d4c5f8a..bd921dc 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -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;
}
--
2.7.4
On Sun, Aug 12, 2018 at 03:11:22AM +0530, Sumit Kumar wrote:
> Adding a mailing list in cc as per recommendation from greg's patch bot.
> + [email protected]
>
> $ scripts/get_maintainer.pl -f
> /tmp/0001-staging-gasket-remove-null-ptr-check-before-kfree.patch
> fatal: /tmp/0001-staging-gasket-remove-null-ptr-check-before-kfree.patch:
> '/tmp/0001-staging-gasket-remove-null-ptr-check-before-kfree.patch' is
> outside repository
> [email protected] (open list)
Do not use -f to point to a patch. Try it again and see what happens...
On Sun, Aug 12, 2018 at 03:17:53AM +0530, Sumit Kumar wrote:
> Remove null ptr check before kfree because kfree is null ptr safe.
> Issue found by checkpatch.
>
> Signed-off-by: Sumit Kumar <[email protected]>
Do not use fake email addresses in a signed-off-by line :(