* [PATCH] staging: gasket: remove null ptr check before kfree
@ 2018-08-11 21:47 Sumit Kumar
2018-08-12 6:39 ` Greg Kroah-Hartman
0 siblings, 1 reply; 6+ messages in thread
From: Sumit Kumar @ 2018-08-11 21:47 UTC (permalink / raw)
To: Rob Springer, John Joseph, Ben Chan, Greg Kroah-Hartman; +Cc: linux-kernel
Remove null ptr check before kfree because kfree is null ptr safe.
Issue found by checkpatch.
Signed-off-by: Sumit Kumar <sumit686215@example.com>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread[parent not found: <20180810203018.GA130845@ubuntu>]
* [PATCH] staging: gasket: remove null ptr check before kfree
@ 2018-08-12 6:58 Sumit Kumar
2018-08-12 12:03 ` Himanshu Jha
0 siblings, 1 reply; 6+ messages in thread
From: Sumit Kumar @ 2018-08-12 6:58 UTC (permalink / raw)
To: Rob Springer, John Joseph, Ben Chan, Greg Kroah-Hartman
Cc: devel, linux-kernel
Remove null ptr check before kfree because kfree is null ptr safe.
Issue found by checkpatch.
Signed-off-by: Sumit Kumar <sumit686215@example.com>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] staging: gasket: remove null ptr check before kfree
2018-08-12 6:58 Sumit Kumar
@ 2018-08-12 12:03 ` Himanshu Jha
0 siblings, 0 replies; 6+ messages in thread
From: Himanshu Jha @ 2018-08-12 12:03 UTC (permalink / raw)
To: Sumit Kumar
Cc: Rob Springer, John Joseph, Ben Chan, Greg Kroah-Hartman, devel,
linux-kernel
On Sun, Aug 12, 2018 at 12:28:37PM +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 <sumit686215@example.com>
Hmm. Victim of copy-paste I guess.
No worries. Next time just use:
$ git commit -s
To understand what -s flag does, refer `man git commit`.
> ---
Now, this where you should have put versions just below the '---':
v2:
- corrected email address.
And yes, the subject should be:
"Subject: [PATCH v2] staging: gasket: remove null ptr check before kfree"
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format
Hope that helps!
--
Himanshu Jha
Undergraduate Student
Department of Electronics & Communication
Guru Tegh Bahadur Institute of Technology
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] staging: gasket: remove null ptr check before kfree
@ 2018-08-12 7:08 Sumit Kumar
0 siblings, 0 replies; 6+ messages in thread
From: Sumit Kumar @ 2018-08-12 7:08 UTC (permalink / raw)
To: Rob Springer, John Joseph, Ben Chan, Greg Kroah-Hartman
Cc: devel, linux-kernel
Remove null ptr check before kfree because kfree is null ptr safe.
Issue found by checkpatch.
Signed-off-by: Sumit Kumar <sumit686215@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-08-12 12:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-11 21:47 [PATCH] staging: gasket: remove null ptr check before kfree Sumit Kumar
2018-08-12 6:39 ` Greg Kroah-Hartman
[not found] <20180810203018.GA130845@ubuntu>
[not found] ` <20180811132704.GA1216@kroah.com>
[not found] ` <CACFOd6VMUgpd5mfpm0ByxKkW64_yoJRn8n58mENhJkeWEF_A=Q@mail.gmail.com>
2018-08-12 6:39 ` Greg Kroah-Hartman
-- strict thread matches above, loose matches on Subject: below --
2018-08-12 6:58 Sumit Kumar
2018-08-12 12:03 ` Himanshu Jha
2018-08-12 7:08 Sumit Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox