Skip to contentSkip to conversation

fs: dlm: lockspace.c: removal of unnecessary check before calling kfree()

PATCH In review Bas Peters 2 participants 4 messages Feb 11, 2015

Subsystems (2)
lore
Share & tools
lore

Bas Peters

author
#0 lore raw

PATCH 1/1 fs: dlm: lockspace.c: removal of unnecessary check before calling kfree()

kfree() checks its argument. It is therefore unnecessary to do this twice.

This issue was detected using Coccinelle.

---
 fs/dlm/lockspace.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/dlm/lockspace.c +1 -2
index f3e7278..b660b93 100644
@@ -674,8 +674,7 @@ static int new_lockspace(const char *name, const char *cluster,
  out_lkbidr:
 	idr_destroy(&ls->ls_lkbidr);
 	for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) {
-		if (ls->ls_remove_names[i])
-			kfree(ls->ls_remove_names[i]);
+		kfree(ls->ls_remove_names[i]);
 	}
  out_rsbtbl:
 	vfree(ls->ls_rsbtbl);
Signature · 1 line
2.1.0
author
#2 lore raw

2015-02-11 13:10 GMT+01:00 SF Markus Elfring <[email protected]>:

Quoted 9 lines
Quoted 3 lines

kfree() checks its argument. It is therefore unnecessary to do this twice.

This issue was detected using Coccinelle.

Would you like to integrate my update suggestion 'fs-DLM: Deletion of unnecessary checks before the function call "kfree"'?
https://lkml.org/lkml/2014/11/29/88
http://article.gmane.org/gmane.linux.kernel/1840524
https://www.mail-archive.com/linux-kernel at vger.kernel.org/msg778279.html

I'll drop that too :)

Quoted 3 lines

Regards,
Markus