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