Commit 009196b4 authored by Daniele Bellucci's avatar Daniele Bellucci Committed by Greg Kroah-Hartman

[PATCH] missing audit in bus_register()

|How about using a goto on the error path to clean up properly
|instead of the different return sections.

.. here goes Take 2:
parent 7a54ce54
......@@ -555,21 +555,36 @@ struct bus_type * find_bus(char * name)
*/
int bus_register(struct bus_type * bus)
{
int retval;
kobject_set_name(&bus->subsys.kset.kobj,bus->name);
subsys_set_kset(bus,bus_subsys);
subsystem_register(&bus->subsys);
retval = subsystem_register(&bus->subsys);
if (retval)
goto out;
kobject_set_name(&bus->devices.kobj, "devices");
bus->devices.subsys = &bus->subsys;
kset_register(&bus->devices);
retval = kset_register(&bus->devices);
if (retval)
goto bus_devices_fail;
kobject_set_name(&bus->drivers.kobj, "drivers");
bus->drivers.subsys = &bus->subsys;
bus->drivers.ktype = &ktype_driver;
kset_register(&bus->drivers);
retval = kset_register(&bus->drivers);
if (retval)
goto bus_drivers_fail;
pr_debug("bus type '%s' registered\n",bus->name);
return 0;
bus_drivers_fail:
kset_unregister(&bus->devices);
bus_devices_fail:
subsystem_unregister(&bus->subsys);
out:
return retval;
}
......
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