diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2015-05-01 21:37:55 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-05-08 09:23:54 +0200 |
commit | ba99a0aff29344797107fc7cca4adc7694c4fd98 (patch) | |
tree | 00afa30d9754d924f3f259d3858be6dad9532414 /drivers/staging/lustre | |
parent | 6fa7cbab38ee64eb78376a32a57cbaa074d766e4 (diff) |
staging: lustre: obdclass: genops: 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: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre')
-rw-r--r-- | drivers/staging/lustre/lustre/obdclass/genops.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index a107aea392e1..37d6aefde534 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -213,12 +213,9 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, return 0; failed: - if (type->typ_name != NULL) - kfree(type->typ_name); - if (type->typ_md_ops != NULL) - kfree(type->typ_md_ops); - if (type->typ_dt_ops != NULL) - kfree(type->typ_dt_ops); + kfree(type->typ_name); + kfree(type->typ_md_ops); + kfree(type->typ_dt_ops); kfree(type); return rc; } @@ -253,10 +250,8 @@ int class_unregister_type(const char *name) list_del(&type->typ_chain); spin_unlock(&obd_types_lock); kfree(type->typ_name); - if (type->typ_dt_ops != NULL) - kfree(type->typ_dt_ops); - if (type->typ_md_ops != NULL) - kfree(type->typ_md_ops); + kfree(type->typ_dt_ops); + kfree(type->typ_md_ops); kfree(type); return 0; } /* class_unregister_type */ |