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


Groups > linux.kernel > #1309376

[PATCH v7 13/15] tty: serial: 8250: Merge duplicate conditions

From Anton Wuerfel <anton.wuerfel@fau.de>
Newsgroups linux.kernel
Subject [PATCH v7 13/15] tty: serial: 8250: Merge duplicate conditions
Date 2016-01-14 16:20 +0100
Message-ID <qQRQS-rb-11@gated-at.bofh.it> (permalink)
References <qQRHc-nE-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This patch refactors a switch case statement by merging an if condition
in the default case into an identical condition right after the switch
statement.
This comes with a slight change in behaviour: If pci_netmos_9900_numports
returns 0, an additional warning is printed.

Signed-off-by: Anton Würfel <anton.wuerfel@fau.de>
Signed-off-by: Phillip Raffeck <phillip.raffeck@fau.de>
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-kernel@i4.cs.fau.de
---
 drivers/tty/serial/8250/8250_pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index fbd4222..b22e5a5 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -850,13 +850,13 @@ static int pci_netmos_init(struct pci_dev *dev)
 			break;
 
 		default:
-			if (num_serial == 0 ) {
-				moan_device("unknown NetMos/Mostech device", dev);
-			}
+			break;
 	}
 
-	if (num_serial == 0)
+	if (num_serial == 0) {
+		moan_device("unknown NetMos/Mostech device", dev);
 		return -ENODEV;
+	}
 
 	return num_serial;
 }
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v7 00/15] tty: serial: 8250: Fix checkpatch warnings Anton Wuerfel <anton.wuerfel@fau.de> - 2016-01-14 16:10 +0100
  [PATCH v7 15/15] tty: serial: 8250: Add generic port init macro Anton Wuerfel <anton.wuerfel@fau.de> - 2016-01-14 16:10 +0100
  [PATCH v7 07/15] tty: serial: 8250: Fix line continuation warning Anton Wuerfel <anton.wuerfel@fau.de> - 2016-01-14 16:10 +0100
  [PATCH v7 09/15] tty: serial: 8250: Fix multi-line strings Anton Wuerfel <anton.wuerfel@fau.de> - 2016-01-14 16:20 +0100
  [PATCH v7 11/15] tty: serial: 8250: Remove SERIAL_DEBUG_PNP macro Anton Wuerfel <anton.wuerfel@fau.de> - 2016-01-14 16:20 +0100
  [PATCH v7 12/15] tty: serial: 8250: Correct conversion specifiers Anton Wuerfel <anton.wuerfel@fau.de> - 2016-01-14 16:20 +0100
  [PATCH v7 13/15] tty: serial: 8250: Merge duplicate conditions Anton Wuerfel <anton.wuerfel@fau.de> - 2016-01-14 16:20 +0100
  [PATCH v7 03/15] tty: serial: 8250: Fix braces after struct Anton Wuerfel <anton.wuerfel@fau.de> - 2016-01-14 16:20 +0100
  [PATCH v7 02/15] tty: serial: 8250: Replace spaces with tabs Anton Wuerfel <anton.wuerfel@fau.de> - 2016-01-14 16:20 +0100
  [PATCH v7 08/15] tty: serial: 8250: Add parentheses to macro Anton Wuerfel <anton.wuerfel@fau.de> - 2016-01-14 16:20 +0100
  [PATCH v7 01/15] tty: serial: 8250: Fix whitespace errors Anton Wuerfel <anton.wuerfel@fau.de> - 2016-01-14 16:20 +0100
  [PATCH v7 10/15] tty: serial: 8250: Suitably replace printk Anton Wuerfel <anton.wuerfel@fau.de> - 2016-01-14 16:20 +0100
  [PATCH v7 05/15] tty: serial: 8250: Remove else after return Anton Wuerfel <anton.wuerfel@fau.de> - 2016-01-14 16:20 +0100
  [PATCH v7 06/15] tty: serial: 8250: Move EXPORT_SYMBOL to function Anton Wuerfel <anton.wuerfel@fau.de> - 2016-01-14 16:20 +0100

csiph-web