Skip to contentSkip to conversation

staging: dgnc: remove variable rc

PATCH Superseded Aastha Gupta 2 participants 3 messages Sep 16, 2017 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: dgnc: remove variable rc

Found using coccinelle script:
@@
local idexpression ret;
expression e;
@@

-ret =
+return

     e;

-return ret;

---
 drivers/staging/dgnc/dgnc_neo.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/dgnc/dgnc_neo.c +1 -4
index 1943e66..a8491d7 100644
@@ -1199,12 +1199,9 @@ 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,
+	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
#1 lore raw
Quoted 21 lines · Aastha Gupta

Found using coccinelle script:
@@
local idexpression ret;
expression e;
@@

(quoted diff) +1 -2
-ret =
+return
     e;
-return ret;
---
 drivers/staging/dgnc/dgnc_neo.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/dgnc/dgnc_neo.c +0 -0
index 1943e66..a8491d7 100644

drivers/staging/dgnc/dgnc_neo.c static int neo_drain(struct tty_struct *tty, uint seconds) · line 1207

Quoted 10 lines
drivers/staging/dgnc/dgnc_neo.c +1 -4
@@ -1199,12 +1199,9 @@ 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,
+	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;

Maybe the comment should be preserved?

julia

Quoted 13 lines
drivers/staging/dgnc/dgnc_neo.c +0 -1
 }
 
 /*
--

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/1505565088-9210-1-git-send-email-aastha.gupta4104%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 37 lines · Aastha Gupta
Quoted 22 lines

Found using coccinelle script:
@@
local idexpression ret;
expression e;
@@

(quoted diff) +1 -2
-ret =
+return
     e;
-return ret;
---
 drivers/staging/dgnc/dgnc_neo.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/dgnc/dgnc_neo.c +0 -0
index 1943e66..a8491d7 100644

drivers/staging/dgnc/dgnc_neo.c static int neo_drain(struct tty_struct *tty, uint seconds) · line 1207

Quoted 10 lines
drivers/staging/dgnc/dgnc_neo.c +1 -4
@@ -1199,12 +1199,9 @@ 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,
+     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;

Maybe the comment should be preserved?

Quoted 2 lines

julia

yes, the comment should be preserved. will do that.

Quoted 13 lines
Quoted 13 lines
drivers/staging/dgnc/dgnc_neo.c +0 -1
 }
 
 /*
--

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/1505565088-9210-1-git-send-email-aastha.gupta4104%40gmail.com.
For more options, visit https://groups.google.com/d/optout.