Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx> --- kernel/events/core.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -13503,11 +13503,11 @@ static int __init perf_event_sysfs_init( struct pmu *pmu; int ret; - mutex_lock(&pmus_lock); + guard(mutex)(&pmus_lock); ret = bus_register(&pmu_bus); if (ret) - goto unlock; + return ret; list_for_each_entry(pmu, &pmus, entry) { if (pmu->dev) @@ -13517,12 +13517,8 @@ static int __init perf_event_sysfs_init( WARN(ret, "Failed to register pmu: %s, reason %d\n", pmu->name, ret); } pmu_bus_running = 1; - ret = 0; -unlock: - mutex_unlock(&pmus_lock); - - return ret; + return 0; } device_initcall(perf_event_sysfs_init);