Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1692937 > unrolled thread
| Started by | sunil.m@techveda.org |
|---|---|
| First post | 2017-07-20 15:40 +0200 |
| Last post | 2017-07-27 18:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] staging: ccree: Fix unnecessary NULL check before kfree'ing it sunil.m@techveda.org - 2017-07-20 15:40 +0200
Re: [PATCH] staging: ccree: Fix unnecessary NULL check before kfree'ing it Gilad Ben-Yossef <gilad@benyossef.com> - 2017-07-27 18:10 +0200
| From | sunil.m@techveda.org |
|---|---|
| Date | 2017-07-20 15:40 +0200 |
| Subject | [PATCH] staging: ccree: Fix unnecessary NULL check before kfree'ing it |
| Message-ID | <u5jQp-87F-23@gated-at.bofh.it> |
From: Suniel Mahesh <sunil.m@techveda.org>
kfree(NULL) is safe and their is no need for a NULL check. Pointed out
by checkpatch.
Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
Note:
- Patch was compile tested and built(ARCH=arm) on next-20170719.
No build issues reported.
---
drivers/staging/ccree/ssi_hash.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c
index fba0643..b080aed 100644
--- a/drivers/staging/ccree/ssi_hash.c
+++ b/drivers/staging/ccree/ssi_hash.c
@@ -296,20 +296,14 @@ static int ssi_hash_map_request(struct device *dev,
fail1:
kfree(state->digest_buff);
fail_digest_result_buff:
- if (state->digest_result_buff) {
- kfree(state->digest_result_buff);
- state->digest_result_buff = NULL;
- }
+ kfree(state->digest_result_buff);
+ state->digest_result_buff = NULL;
fail_buff1:
- if (state->buff1) {
- kfree(state->buff1);
- state->buff1 = NULL;
- }
+ kfree(state->buff1);
+ state->buff1 = NULL;
fail_buff0:
- if (state->buff0) {
- kfree(state->buff0);
- state->buff0 = NULL;
- }
+ kfree(state->buff0);
+ state->buff0 = NULL;
fail0:
return rc;
}
@@ -2319,11 +2313,8 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata)
return 0;
fail:
-
- if (drvdata->hash_handle) {
- kfree(drvdata->hash_handle);
- drvdata->hash_handle = NULL;
- }
+ kfree(drvdata->hash_handle);
+ drvdata->hash_handle = NULL;
return rc;
}
--
1.9.1
[toc] | [next] | [standalone]
| From | Gilad Ben-Yossef <gilad@benyossef.com> |
|---|---|
| Date | 2017-07-27 18:10 +0200 |
| Subject | Re: [PATCH] staging: ccree: Fix unnecessary NULL check before kfree'ing it |
| Message-ID | <u7Twm-8ht-3@gated-at.bofh.it> |
| In reply to | #1692937 |
Hi, On Thu, Jul 20, 2017 at 4:37 PM, <sunil.m@techveda.org> wrote: > From: Suniel Mahesh <sunil.m@techveda.org> > > kfree(NULL) is safe and their is no need for a NULL check. Pointed out > by checkpatch. > > Signed-off-by: Suniel Mahesh <sunil.m@techveda.org> > --- > Note: > - Patch was compile tested and built(ARCH=arm) on next-20170719. > No build issues reported. Patch applies against staging-next + latest changes and it builds and runs. Acked-by: Gilad Ben-Yossef <gilad@benyossef.com> Gilad
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web