cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] fs: dlm: lockspace.c: removal of unnecessary check before calling kfree()
@ 2015-02-11  9:26 Bas Peters
  2015-02-11 12:10 ` SF Markus Elfring
  0 siblings, 1 reply; 4+ messages in thread
From: Bas Peters @ 2015-02-11  9:26 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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

This issue was detected using Coccinelle.

Signed-off-by: Bas Peters <baspeters93@gmail.com>
---
 fs/dlm/lockspace.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index f3e7278..b660b93 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -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);
-- 
2.1.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Cluster-devel] [PATCH] fs: dlm: lockspace.c: removal of unnecessary check before calling kfree()
  2015-02-11  9:26 [Cluster-devel] [PATCH] fs: dlm: lockspace.c: removal of unnecessary check before calling kfree() Bas Peters
@ 2015-02-11 12:10 ` SF Markus Elfring
  2015-02-11 12:12   ` Bas Peters
  0 siblings, 1 reply; 4+ messages in thread
From: SF Markus Elfring @ 2015-02-11 12:10 UTC (permalink / raw)
  To: cluster-devel.redhat.com

> 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

Regards,
Markus



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Cluster-devel] [PATCH] fs: dlm: lockspace.c: removal of unnecessary check before calling kfree()
  2015-02-11 12:10 ` SF Markus Elfring
@ 2015-02-11 12:12   ` Bas Peters
  2015-02-11 12:20     ` SF Markus Elfring
  0 siblings, 1 reply; 4+ messages in thread
From: Bas Peters @ 2015-02-11 12:12 UTC (permalink / raw)
  To: cluster-devel.redhat.com

2015-02-11 13:10 GMT+01:00 SF Markus Elfring <elfring@users.sourceforge.net>:
>> 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 :)

> Regards,
> Markus
>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Cluster-devel] [PATCH] fs: dlm: lockspace.c: removal of unnecessary check before calling kfree()
  2015-02-11 12:12   ` Bas Peters
@ 2015-02-11 12:20     ` SF Markus Elfring
  0 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2015-02-11 12:20 UTC (permalink / raw)
  To: cluster-devel.redhat.com

>> 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 :)

Would you like to add any tags to my update suggestion?

Are you looking for more opportunities around clean-up of such safety checks
in Linux source code?

Regards,
Markus



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-11 12:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-11  9:26 [Cluster-devel] [PATCH] fs: dlm: lockspace.c: removal of unnecessary check before calling kfree() Bas Peters
2015-02-11 12:10 ` SF Markus Elfring
2015-02-11 12:12   ` Bas Peters
2015-02-11 12:20     ` SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).