Skip to content

Commit

Permalink
greybus: uart: Fix the memory leak in connection init
Browse files Browse the repository at this point in the history
If alloc minor is error, gb_tty should free.

Signed-off-by: Phong Tran <[email protected]>
Reviewed-by: Viresh Kumar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
phongt authored and gregkh committed Jun 4, 2015
1 parent 3cb494c commit 55f2291
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/staging/greybus/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 55f2291

Please sign in to comment.