greybus: loopback: add more clean up when init connection fails
It should remove the object from sysfs when loopback connection init error. Signed-off-by: Phong Tran <tranmanphong@gmail.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
65cac604b2
commit
6f8528e0be
@ -401,23 +401,25 @@ static int gb_loopback_connection_init(struct gb_connection *connection)
|
||||
connection->private = gb;
|
||||
retval = sysfs_create_groups(&connection->dev.kobj, loopback_groups);
|
||||
if (retval)
|
||||
goto error;
|
||||
goto out_free;
|
||||
|
||||
/* Check the version */
|
||||
retval = get_version(gb);
|
||||
if (retval)
|
||||
goto error;
|
||||
goto out_get_ver;
|
||||
|
||||
gb_loopback_reset_stats(gb);
|
||||
gb->task = kthread_run(gb_loopback_fn, gb, "gb_loopback");
|
||||
if (IS_ERR(gb->task)) {
|
||||
retval = PTR_ERR(gb->task);
|
||||
goto error;
|
||||
goto out_get_ver;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
out_get_ver:
|
||||
sysfs_remove_groups(&connection->dev.kobj, loopback_groups);
|
||||
out_free:
|
||||
kfree(gb);
|
||||
return retval;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user