Commit 659c2040 authored by Patrick Mochel's avatar Patrick Mochel

kobjects: don't do cleanup if kobject_add() fails.

kobject_register() has the rude behavior that it will attempt to clean up
the kobject if kobject_add() fails. This replaces that with a WARN_ON() for
the return value, and leaves the cleanup to the caller.
parent fc8aae53
......@@ -110,8 +110,7 @@ int kobject_register(struct kobject * kobj)
if (kobj) {
kobject_init(kobj);
error = kobject_add(kobj);
if (error)
kobject_cleanup(kobj);
WARN_ON(error);
} else
error = -EINVAL;
return error;
......
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