linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shraddha Barke <shraddha.6596@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Staging:dgap :Compression of lines for immediate return
Date: Sun, 26 Jul 2015 23:04:13 +0530	[thread overview]
Message-ID: <20150726173413.GA30485@shraddha-370R4E-370R4V-370R5E-3570RE-370R5V> (raw)

This patch compresses two lines into a single line if immediate return statement
is found. Also,remove variable rc as it is no longer needed.
It is done using tool Coccinelle. And semantic patch used for this is as follows:

@@
expression ret;
identifier f;
@@

-ret =
+return
     f(...);
-return ret;
---
 drivers/staging/dgap/dgap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 26b0446..2bb6c68 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -4953,9 +4953,8 @@ static int dgap_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 		spin_unlock_irqrestore(&ch->ch_lock, lock_flags2);
 		spin_unlock_irqrestore(&bd->bd_lock, lock_flags);
 
-		rc = put_user(C_CLOCAL(tty) ? 1 : 0,
+		return put_user(C_CLOCAL(tty) ? 1 : 0,
 				(unsigned long __user *) arg);
-		return rc;
 
 	case TIOCSSOFTCAR:
 		spin_unlock_irqrestore(&ch->ch_lock, lock_flags2);
-- 
2.1.0


             reply	other threads:[~2015-07-26 17:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-26 17:34 Shraddha Barke [this message]
2015-07-26 19:39 ` [PATCH] Staging:dgap :Compression of lines for immediate return Joe Perches
2015-07-27  4:30 ` Sudip Mukherjee
2015-07-27 17:37 Shraddha Barke
2015-07-27 18:00 Shraddha Barke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150726173413.GA30485@shraddha-370R4E-370R4V-370R5E-3570RE-370R5V \
    --to=shraddha.6596@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).