提交 34b8fbd6 编写于 作者: J Julia Lawall 提交者: Greg Kroah-Hartman

staging: lustre: lov: lov_dev: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>
Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 13879e5d
...@@ -298,8 +298,7 @@ static struct lu_device *lov_device_free(const struct lu_env *env, ...@@ -298,8 +298,7 @@ static struct lu_device *lov_device_free(const struct lu_env *env,
const int nr = ld->ld_target_nr; const int nr = ld->ld_target_nr;
cl_device_fini(lu2cl_dev(d)); cl_device_fini(lu2cl_dev(d));
if (ld->ld_target != NULL) kfree(ld->ld_target);
kfree(ld->ld_target);
if (ld->ld_emrg != NULL) if (ld->ld_emrg != NULL)
lov_emerg_free(ld->ld_emrg, nr); lov_emerg_free(ld->ld_emrg, nr);
kfree(ld); kfree(ld);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册