Commit 55f22911 authored by Phong Tran's avatar Phong Tran Committed by Greg Kroah-Hartman
Browse files

greybus: uart: Fix the memory leak in connection init



If alloc minor is error, gb_tty should free.

Signed-off-by: default avatarPhong Tran <tranmanphong@gmail.com>
Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 3cb494cd
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -618,9 +618,11 @@ static int gb_uart_connection_init(struct gb_connection *connection)
		if (minor == -ENOSPC) {
			dev_err(&connection->dev,
				"no more free minor numbers\n");
			return -ENODEV;
			retval = -ENODEV;
			goto error_version;
		}
		return minor;
		retval = minor;
		goto error_version;
	}

	gb_tty->minor = minor;