USB: serial: f81534: clean up calc_num_ports
authorJohan Hovold <johan@kernel.org>
Thu, 16 Mar 2017 16:13:57 +0000 (17:13 +0100)
committerJohan Hovold <johan@kernel.org>
Tue, 28 Mar 2017 09:14:13 +0000 (11:14 +0200)
Clean up calc_num_ports with respect to handling older chips that lack
config data.

Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/f81534.c

index be106f4e3e57516e55622b3d85780bb4ebbd2fef..365e3acd6c6c3ecb321f8b3defa4d406dac56aa5 100644 (file)
@@ -681,12 +681,13 @@ static int f81534_calc_num_ports(struct usb_serial *serial,
                ++num_port;
        }
 
-       if (num_port)
-               return num_port;
+       if (!num_port) {
+               dev_warn(&serial->interface->dev,
+                       "no config found, assuming 4 ports\n");
+               num_port = 4;           /* Nothing found, oldest version IC */
+       }
 
-       dev_warn(&serial->interface->dev, "%s: Read Failed. default 4 ports\n",
-                       __func__);
-       return 4;               /* Nothing found, oldest version IC */
+       return num_port;
 }
 
 static void f81534_set_termios(struct tty_struct *tty,