Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7592e674 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: android: Ensure at least two serial ports are initialized"

parents 41bb927f f328227d
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -1886,6 +1886,19 @@ static int serial_function_bind_config(struct android_usb_function *f,
			}
		}
	}
	/*
	 * Make sure we always have two serials ports initialized to allow
	 * switching composition from 1 serial function to 2 serial functions.
	 * Mark 2nd port to use tty if user didn't specify transport.
	 */
	if ((config->instances_on == 1) && !serial_initialized) {
		err = gserial_init_port(ports, "tty", "serial_tty");
		if (err) {
			pr_err("serial: Cannot open port '%s'", "tty");
			goto out;
		}
		config->instances_on++;
	}

	/* limit the serial ports init only for boot ports */
	if (ports > config->instances_on)
@@ -1900,8 +1913,7 @@ static int serial_function_bind_config(struct android_usb_function *f,
		goto out;
	}

	config->instances_on = ports;
	for (i = 0; i < ports; i++) {
	for (i = 0; i < config->instances_on; i++) {
		config->f_serial_inst[i] = usb_get_function_instance("gser");
		if (IS_ERR(config->f_serial_inst[i])) {
			err = PTR_ERR(config->f_serial_inst[i]);