linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shraddha Barke <shraddha.6596@gmail.com>
To: shraddha <f2013344@goa.bits-pilani.ac.in>
Cc: linux-kernel@vger.kernel.org, Shraddha Barke <shraddha.6596@gmail.com>
Subject: [PATCH 2756/2756] Staging: acpi: Merge lines for immediate return
Date: Fri, 24 Jul 2015 22:25:31 +0530	[thread overview]
Message-ID: <1437756931-9990-1-git-send-email-shraddha.6596@gmail.com> (raw)

This patch merges two lines in a single line if immediate return is found.
This is done using Coccinelle.Semantic patch used for this is as follows:

@@
expression ret;
identifier f;
@@

-ret =
+return
     f(...);
-return ret;

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/acpi/apei/erst.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 3670bba..58e1bdd 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -162,8 +162,7 @@ static int erst_exec_add_value(struct apei_exec_context *ctx,
 	if (rc)
 		return rc;
 	val += ctx->value;
-	rc = __apei_exec_write_register(entry, val);
-	return rc;
+	return __apei_exec_write_register(entry, val);
 }
 
 static int erst_exec_subtract_value(struct apei_exec_context *ctx,
@@ -176,8 +175,7 @@ static int erst_exec_subtract_value(struct apei_exec_context *ctx,
 	if (rc)
 		return rc;
 	val -= ctx->value;
-	rc = __apei_exec_write_register(entry, val);
-	return rc;
+	return __apei_exec_write_register(entry, val);
 }
 
 static int erst_exec_stall(struct apei_exec_context *ctx,
@@ -979,9 +977,7 @@ static int erst_open_pstore(struct pstore_info *psi)
 	if (erst_disable)
 		return -ENODEV;
 
-	rc = erst_get_record_id_begin(&reader_pos);
-
-	return rc;
+	return erst_get_record_id_begin(&reader_pos);
 }
 
 static int erst_close_pstore(struct pstore_info *psi)
-- 
2.1.0


             reply	other threads:[~2015-07-24 16:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 16:55 Shraddha Barke [this message]
2015-07-24 17:00 [PATCH 2756/2756] Staging: acpi: Merge lines for immediate return Shraddha Barke
2015-07-24 22:07 ` Kees Cook

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=1437756931-9990-1-git-send-email-shraddha.6596@gmail.com \
    --to=shraddha.6596@gmail.com \
    --cc=f2013344@goa.bits-pilani.ac.in \
    --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).