Commit ba658584 authored by Todd Poynor's avatar Todd Poynor Committed by Greg Kroah-Hartman

staging: gasket: remove driver registration on class creation failure

If class_create() fails, remove the gasket driver from the global
registration table.
Signed-off-by: default avatarZhongze Hu <frankhu@chromium.org>
Signed-off-by: default avatarTodd Poynor <toddpoynor@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b17cef4d
......@@ -335,7 +335,8 @@ int gasket_register_device(const struct gasket_driver_desc *driver_desc)
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;
}
/*
......@@ -369,6 +370,7 @@ int gasket_register_device(const struct gasket_driver_desc *driver_desc)
fail1:
class_destroy(internal->class);
unregister_gasket_driver:
g_descs[desc_idx].driver_desc = NULL;
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment