If class_create() fails, remove the gasket driver from the global
registration table.
Signed-off-by: Zhongze Hu <frankhu@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
if (IS_ERR_OR_NULL(internal->class)) {
gasket_nodev_error("Cannot register %s class [ret=%ld]",
driver_desc->name, PTR_ERR(internal->class));
- return PTR_ERR(internal->class);
+ ret = PTR_ERR(internal->class);
+ goto unregister_gasket_driver;
}
/*
fail1:
class_destroy(internal->class);
+unregister_gasket_driver:
g_descs[desc_idx].driver_desc = NULL;
return ret;
}