Skip to contentSkip to conversation

Staging: dgnc: Removed unnecessary braces

PATCH In review Yeliz Taneroglu 2 participants 2 messages Feb 20, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: dgnc: Removed unnecessary braces

The following patch fixes the checkpatch.pl warning:
WARNING: braces {} are not necessary for single statement blocks

---
 drivers/staging/dgnc/dgnc_tty.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)
drivers/staging/dgnc/dgnc_tty.c +6 -14
index a4e6c9e..67dc8ef 100644
@@ -1008,9 +1008,8 @@ void dgnc_check_queue_flow_control(struct channel_t *ch)
 			}
 		}
 		/* No FLOW */
-		else {
+		else
 			/* Empty... Can't do anything about the impending overflow... */
-		}
 	}
 
 	/*
@@ -1042,9 +1041,8 @@ void dgnc_check_queue_flow_control(struct channel_t *ch)
 			ch->ch_bd->bd_ops->send_start_character(ch);
 		}
 		/* No FLOW */
-		else {
+		else
 			/* Nothing needed. */
-		}
 	}
 }
 
@@ -1127,9 +1125,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
 		 * the queue AND FIFO are both empty.
 		 */
 		if (ch->ch_pun.un_flags & UN_EMPTY) {
-			if ((qlen == 0) && (ch->ch_bd->bd_ops->get_uart_bytes_left(ch) == 0)) {
+			if ((qlen == 0) && (ch->ch_bd->bd_ops->get_uart_bytes_left(ch) == 0))
 				ch->ch_pun.un_flags &= ~(UN_EMPTY);
-			}
 		}
 
 		wake_up_interruptible(&ch->ch_pun.un_flags_wait);
@@ -1363,9 +1360,8 @@ static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file, struc
 	uint	old_flags = 0;
 	int	sleep_on_un_flags = 0;
 
-	if (!tty || tty->magic != TTY_MAGIC || !file || !ch || ch->magic != DGNC_CHANNEL_MAGIC) {
+	if (!tty || tty->magic != TTY_MAGIC || !file || !ch || ch->magic != DGNC_CHANNEL_MAGIC)
 		return -ENXIO;
-	}
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
@@ -2815,9 +2811,8 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 
 		DGNC_LOCK(ch->ch_lock, lock_flags);
 
-		if (((cmd == TCSBRK) && (!arg)) || (cmd == TCSBRKP)) {
+		if (((cmd == TCSBRK) && (!arg)) || (cmd == TCSBRKP))
 			ch->ch_bd->bd_ops->send_break(ch, 250);
-		}
 
 		DGNC_UNLOCK(ch->ch_lock, lock_flags);
 
@@ -3122,11 +3117,8 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 			events |= EV_TXB;
 		if ((ch->ch_flags & CH_STOP) || (ch->ch_flags & CH_FORCED_STOP))
 			events |= (EV_OPU | EV_OPS);
-
-		if ((ch->ch_flags & CH_STOPI) || (ch->ch_flags & CH_FORCED_STOPI)) {
+		if ((ch->ch_flags & CH_STOPI) || (ch->ch_flags & CH_FORCED_STOPI))
 			events |= (EV_IPU | EV_IPS);
-		}
-
 		DGNC_UNLOCK(ch->ch_lock, lock_flags);
 		rc = put_user(events, (unsigned int __user *) arg);
 		return rc;
Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 13 lines · Yeliz Taneroglu

The following patch fixes the checkpatch.pl warning:
WARNING: braces {} are not necessary for single statement blocks

---
 drivers/staging/dgnc/dgnc_tty.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)
drivers/staging/dgnc/dgnc_tty.c +0 -0
index a4e6c9e..67dc8ef 100644

drivers/staging/dgnc/dgnc_tty.c void dgnc_check_queue_flow_control(struct channel_t *ch) · line 1013

Quoted 7 lines
drivers/staging/dgnc/dgnc_tty.c +1 -2
@@ -1008,9 +1008,8 @@ void dgnc_check_queue_flow_control(struct channel_t *ch)
 			}
 		}
 		/* No FLOW */
-		else {
+		else
 			/* Empty... Can't do anything about the impending overflow... */
-		}

Sorry not to have been clear. An else with nothing after it at all is not valid C code (comments don't count). Checkpatch does not know what is a statement and what is not. Either you leave the code as it is, or you remove everything, probably including the comment.

julia

Quoted 70 lines
drivers/staging/dgnc/dgnc_tty.c +5 -13
 	}
 
 	/*
@@ -1042,9 +1041,8 @@ void dgnc_check_queue_flow_control(struct channel_t *ch)
 			ch->ch_bd->bd_ops->send_start_character(ch);
 		}
 		/* No FLOW */
-		else {
+		else
 			/* Nothing needed. */
-		}
 	}
 }
 
@@ -1127,9 +1125,8 @@ void dgnc_wakeup_writes(struct channel_t *ch)
 		 * the queue AND FIFO are both empty.
 		 */
 		if (ch->ch_pun.un_flags & UN_EMPTY) {
-			if ((qlen == 0) && (ch->ch_bd->bd_ops->get_uart_bytes_left(ch) == 0)) {
+			if ((qlen == 0) && (ch->ch_bd->bd_ops->get_uart_bytes_left(ch) == 0))
 				ch->ch_pun.un_flags &= ~(UN_EMPTY);
-			}
 		}
 
 		wake_up_interruptible(&ch->ch_pun.un_flags_wait);
@@ -1363,9 +1360,8 @@ static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file, struc
 	uint	old_flags = 0;
 	int	sleep_on_un_flags = 0;
 
-	if (!tty || tty->magic != TTY_MAGIC || !file || !ch || ch->magic != DGNC_CHANNEL_MAGIC) {
+	if (!tty || tty->magic != TTY_MAGIC || !file || !ch || ch->magic != DGNC_CHANNEL_MAGIC)
 		return -ENXIO;
-	}
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
@@ -2815,9 +2811,8 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 
 		DGNC_LOCK(ch->ch_lock, lock_flags);
 
-		if (((cmd == TCSBRK) && (!arg)) || (cmd == TCSBRKP)) {
+		if (((cmd == TCSBRK) && (!arg)) || (cmd == TCSBRKP))
 			ch->ch_bd->bd_ops->send_break(ch, 250);
-		}
 
 		DGNC_UNLOCK(ch->ch_lock, lock_flags);
 
@@ -3122,11 +3117,8 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 			events |= EV_TXB;
 		if ((ch->ch_flags & CH_STOP) || (ch->ch_flags & CH_FORCED_STOP))
 			events |= (EV_OPU | EV_OPS);
-
-		if ((ch->ch_flags & CH_STOPI) || (ch->ch_flags & CH_FORCED_STOPI)) {
+		if ((ch->ch_flags & CH_STOPI) || (ch->ch_flags & CH_FORCED_STOPI))
 			events |= (EV_IPU | EV_IPS);
-		}
-
 		DGNC_UNLOCK(ch->ch_lock, lock_flags);
 		rc = put_user(events, (unsigned int __user *) arg);
 		return rc;
--

1.8.3.2

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