staging: dgnc: remove variable rc
PATCH v2 1/1 staging: dgnc: remove variable rc
Found using coccinelle script:
@@
local idexpression ret;
expression e;
@@
-ret =
+return
e;
-return ret;
---
changes in v2:
- preserved comment regarding return value
drivers/staging/dgnc/dgnc_neo.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/dgnc/dgnc_neo.c +2 -5
@@ -1182,7 +1182,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)return -ENXIO ;
@@ -1199,12 +1198,10 @@ static int neo_drain(struct tty_struct *tty, uint seconds) un->un_flags |=UN_EMPTY ;spin_unlock_irqrestore (&ch->ch_lock, flags); - rc =wait_event_interruptible_timeout (un->un_flags_wait, +/* If returned value is non-zero, user ctrl-c'ed us */ +return wait_event_interruptible_timeout (un->un_flags_wait, ((un->un_flags &UN_EMPTY ) ==0 ),msecs_to_jiffies (seconds *1000 )); - -/* If ret is non-zero, user ctrl-c'ed us */ -return rc; }/*
Signature · 1 line
2.7.4
Quoted 32 lines · Aastha Gupta
Found using coccinelle script:
@@
local idexpression ret;
expression e;
@@(quoted diff) +1
-2-ret = +return e; -return ret;Signed-off-by Aastha Gupta <[email protected]>---
changes in v2:
- preserved comment regarding return valuedrivers/staging/dgnc/dgnc_neo.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/staging/dgnc/dgnc_neo.c +0
-1@@ -1182,7 +1182,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)return -ENXIO ;
drivers/staging/dgnc/dgnc_neo.c static int neo_drain(struct tty_struct *tty, uint seconds) · line 1204
Quoted 8 lines
drivers/staging/dgnc/dgnc_neo.c +2
-1@@ -1199,12 +1198,10 @@ static int neo_drain(struct tty_struct *tty, uint seconds) un->un_flags |=UN_EMPTY ;spin_unlock_irqrestore (&ch->ch_lock, flags); - rc =wait_event_interruptible_timeout (un->un_flags_wait, +/* If returned value is non-zero, user ctrl-c'ed us */ +return wait_event_interruptible_timeout (un->un_flags_wait, ((un->un_flags &UN_EMPTY ) ==0 ),msecs_to_jiffies (seconds *1000 ));
The comment looks good now. By there is another small issue, which is that since you have pushed the call a bit to the right by using return, the arguments of the call have to move to the right too. Hopefully they will still fit on one line. If not, you could align the arguments at the nearest preceding tab.
julia
Quoted 16 lines
drivers/staging/dgnc/dgnc_neo.c +0
-4- -/* If ret is non-zero, user ctrl-c'ed us */ -return rc; }/* -- 2.7.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1505566784-15237-1-git-send-email-aastha.gupta4104%40gmail.com.
For more options, visit https://groups.google.com/d/optout.