public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] coccinelle: if(ret)return ret; return ret; semantic patch
@ 2011-06-06  0:26 Greg Dietsche
  2011-06-06  4:55 ` Julia Lawall
  2011-06-06  4:56 ` Julia Lawall
  0 siblings, 2 replies; 26+ messages in thread
From: Greg Dietsche @ 2011-06-06  0:26 UTC (permalink / raw)
  To: julia; +Cc: Gilles.Muller, npalix.work, cocci, linux-kernel, Greg Dietsche

This semantic patch finds code matching this pattern:
	if(ret)
		return ret;
	return ret;

I will be submitting patches shortly against the mainline to cleanup all
code matching this pattern.

Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
---
 scripts/coccinelle/misc/doublereturn.cocci |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
 create mode 100644 scripts/coccinelle/misc/doublereturn.cocci

diff --git a/scripts/coccinelle/misc/doublereturn.cocci b/scripts/coccinelle/misc/doublereturn.cocci
new file mode 100644
index 0000000..656a118
--- /dev/null
+++ b/scripts/coccinelle/misc/doublereturn.cocci
@@ -0,0 +1,20 @@
+/// Remove unecessary if/return in code that follows this pattern:
+///	if(retval)
+///		return retval;
+///	return retval;
+//
+// Confidence: High
+// Copyright: (C) 2011 Greg Dietsche GPLv2.
+// URL: http://www.gregd.org
+// Comments:
+// Options: -no_includes
+
+virtual patch
+
+@@
+identifier retval;
+@@
+-if (retval)
+-	return retval;
+-return retval;
++return retval;
-- 
1.7.2.5


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

end of thread, other threads:[~2011-06-15 16:05 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-06  0:26 [PATCH] coccinelle: if(ret)return ret; return ret; semantic patch Greg Dietsche
2011-06-06  4:55 ` Julia Lawall
2011-06-07 15:47   ` Greg Dietsche
2011-06-07 16:56     ` Julia Lawall
2011-06-07 21:54       ` Nicolas Palix
2011-06-07 22:59         ` Greg Dietsche
2011-06-08  7:11           ` Nicolas Palix
2011-06-08  7:24             ` Julia Lawall
2011-06-11 15:37   ` Greg Dietsche
2011-06-11 15:43     ` Julia Lawall
2011-06-06  4:56 ` Julia Lawall
2011-06-13 18:23   ` [PATCH v2] coccinelle: if (ret) return " Greg Dietsche
2011-06-13 18:36     ` Joe Perches
2011-06-13 18:38     ` Julia Lawall
2011-06-13 20:55       ` Greg Dietsche
2011-06-14  5:50         ` Julia Lawall
2011-06-14 21:24           ` Greg Dietsche
2011-06-15  1:15             ` Greg Dietsche
2011-06-15  5:58               ` Julia Lawall
2011-06-15 15:33                 ` [Cocci] " Greg Dietsche
2011-06-15 15:34                   ` Julia Lawall
2011-06-15 15:35                   ` Julia Lawall
2011-06-15 16:05                     ` Greg Dietsche
2011-06-15  1:29       ` [PATCH v3] " Greg Dietsche
2011-06-15  5:50         ` Julia Lawall
2011-06-15 15:50         ` [PATCH v4] " Greg Dietsche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox