Re: [PATCH v5 15/15] tty: serial: 8250: Merge duplicate conditions

From: Andy Shevchenko
Date: Wed Jan 13 2016 - 12:30:39 EST


On Wed, 2016-01-13 at 17:39 +0100, Anton Wuerfel wrote:
> 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.
>

+ Suggested-by:

And I would recommend to put this patch before #13 in the series.

> Signed-off-by: Anton WÃrfel <anton.wuerfel@xxxxxx>
> Signed-off-by: Phillip Raffeck <phillip.raffeck@xxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxx
> ---
> Âdrivers/tty/serial/8250/8250_pci.c | 4 +++-
> Â1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_pci.c
> b/drivers/tty/serial/8250/8250_pci.c
> index 1dd607f..50ab301 100644
> --- a/drivers/tty/serial/8250/8250_pci.c
> +++ b/drivers/tty/serial/8250/8250_pci.c
> @@ -854,8 +854,10 @@ static int pci_netmos_init(struct pci_dev *dev)
> Â }
> Â }
> Â
> - if (num_serial == 0)
> + if (num_serial == 0) {
> + moan_device("unknown NetMos/Mostech device", dev);
> Â return -ENODEV;
> + }

Yep!
However, you forgot to fix switch-case as well.

> Â
> Â return num_serial;
> Â}

--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy