diff mbox series

[v3,53/57] perf: Simplify perf_event_sysfs_init()

Message ID 20230612093541.382527855@infradead.org (mailing list archive)
State New, archived
Headers show
Series Scope-based Resource Management | expand

Commit Message

Peter Zijlstra June 12, 2023, 9:08 a.m. UTC
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 kernel/events/core.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
diff mbox series

Patch

--- 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);