driver core: bus: Add simple error handling for buses_init()
Add simple error handling for buses_init() since it is easy to do. Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com> Link: https://lore.kernel.org/r/20240727-buses_init-v1-1-e863295a2c0e@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0314647dec
commit
2bdf3b8351
+6
-1
@@ -1387,8 +1387,13 @@ int __init buses_init(void)
|
||||
return -ENOMEM;
|
||||
|
||||
system_kset = kset_create_and_add("system", NULL, &devices_kset->kobj);
|
||||
if (!system_kset)
|
||||
if (!system_kset) {
|
||||
/* Do error handling here as devices_init() do */
|
||||
kset_unregister(bus_kset);
|
||||
bus_kset = NULL;
|
||||
pr_err("%s: failed to create and add kset 'bus'\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user