소스 검색

USB: serial: f81534: clean up calc_num_ports

Clean up calc_num_ports with respect to handling older chips that lack
config data.

Signed-off-by: Johan Hovold <johan@kernel.org>
Johan Hovold 8 년 전
부모
커밋
5e07240a12
1개의 변경된 파일6개의 추가작업 그리고 5개의 파일을 삭제
  1. 6 5
      drivers/usb/serial/f81534.c

+ 6 - 5
drivers/usb/serial/f81534.c

@@ -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,