Staging: dgnc: Merge lines and remove unused variable for immediate return
PATCH 1/1 Staging: dgnc: Merge lines and remove unused variable for immediate return
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 <[email protected]>
--- drivers/staging/dgnc/dgnc_neo.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/staging/dgnc/dgnc_neo.c +1 -5
@@ -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 )); }
Signature · 1 line
2.1.0
Quoted 3 lines · Shraddha Barke
This patch compresses two lines into a single line if immediate return is found. Variable rc is dropped as it is no longer needed.
<snip>
drivers/staging/dgnc/dgnc_neo.c static int neo_drain(struct tty_struct *tty, uint seconds) · line 1341
Quoted 2 lines
drivers/staging/dgnc/dgnc_neo.c +1
-1-return rc; +return wait_event_interruptible (un->un_flags_wait, ((un->un_flags &UN_EMPTY ) ==0 ));
This is introducing new checkpatch warning about line more than 80 char.
regards
sudip