greybus: uart: Fix the memory leak in connection init

If alloc minor is error, gb_tty should free.

Signed-off-by: Phong Tran <tranmanphong@gmail.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Phong Tran 2015-06-01 22:19:45 +07:00 committed by Greg Kroah-Hartman
parent 3cb494cd6c
commit 55f2291142
1 changed files with 4 additions and 2 deletions

View File

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