Commit f999d098 authored by Shraddha Barke's avatar Shraddha Barke Committed by Greg Kroah-Hartman

Staging: lustre: osc: Remove null check before kfree

kfree on NULL pointer is a no-op.
The semantic patch used to find such an instance where NULL check is
present before kfree-

// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);
@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>smpl>
Signed-off-by: default avatarShraddha Barke <shraddha.6596@gmail.com>
Reviewed-by: default avatarDaniel Baluta <daniel.baluta@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 03a7fc24
...@@ -1998,9 +1998,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, ...@@ -1998,9 +1998,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
if (mem_tight != 0) if (mem_tight != 0)
cfs_memory_pressure_restore(mpflag); cfs_memory_pressure_restore(mpflag);
if (crattr != NULL) {
kfree(crattr); kfree(crattr);
}
if (rc != 0) { if (rc != 0) {
LASSERT(req == NULL); LASSERT(req == NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment