Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1193147 > unrolled thread

[PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return

Started byShraddha Barke <shraddha.6596@gmail.com>
First post2015-07-27 16:10 +0200
Last post2015-07-28 13:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return Shraddha Barke <shraddha.6596@gmail.com> - 2015-07-27 16:10 +0200
    Re: [PATCH] Staging: dgnc: Merge lines and remove unused variable  for immediate return Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-07-28 13:20 +0200

#1193147 — [PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return

FromShraddha Barke <shraddha.6596@gmail.com>
Date2015-07-27 16:10 +0200
Subject[PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return
Message-ID<pQRgn-46U-39@gated-at.bofh.it>
This patch compresses two lines into a single line if immediate return
is found. Variable rc is dropped as it is no longer needed.

Semantic patch used for this is as follows:

@@
type T;
identifier i,f;
constant C;
@@
- T i;
  ...when != i
     when strict
(
  return -C;
|
- i =
+ return
     f(...);
- return i;
)

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/dgnc/dgnc_neo.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 900e3ae..321783c 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -1316,7 +1316,6 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
 	unsigned long flags;
 	struct channel_t *ch;
 	struct un_t *un;
-	int rc = 0;
 
 	if (!tty || tty->magic != TTY_MAGIC)
 		return -ENXIO;
@@ -1339,10 +1338,7 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
 	 *
 	 * NOTE: TODO: Do something with time passed in.
 	 */
-	rc = wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
-
-	/* If ret is non-zero, user ctrl-c'ed us */
-	return rc;
+	return wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
 }
 
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1194133 — Re: [PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-07-28 13:20 +0200
SubjectRe: [PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return
Message-ID<pRb5p-7Bt-43@gated-at.bofh.it>
In reply to#1193147
On Mon, Jul 27, 2015 at 07:35:15PM +0530, Shraddha Barke wrote:
> This patch compresses two lines into a single line if immediate return
> is found. Variable rc is dropped as it is no longer needed.

same patch again?

regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web