diff options
author | Zijun Hu <quic_zijuhu@quicinc.com> | 2024-07-27 14:08:34 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-07-31 14:55:40 +0200 |
commit | 2bdf3b83515ead3b3fdf93610e4a3bb9a89bc852 (patch) | |
tree | 5349583d04f22f6f0e43f0fb4e25cb3cdbb61c2e | |
parent | 0314647dec70bf0e856303dc70d00e9f1ba568ba (diff) | |
download | linux-2bdf3b83515ead3b3fdf93610e4a3bb9a89bc852.tar.gz linux-2bdf3b83515ead3b3fdf93610e4a3bb9a89bc852.tar.bz2 linux-2bdf3b83515ead3b3fdf93610e4a3bb9a89bc852.zip |
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>
-rw-r--r-- | drivers/base/bus.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 8bf04d5ef51d..5bb1dca96242 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -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; } |