[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20210809034941.2264-1-thunder.leizhen@huawei.com>
Date: Mon, 9 Aug 2021 11:49:41 +0800
From: Zhen Lei <thunder.leizhen@...wei.com>
To: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
"Namhyung Kim" <namhyung@...nel.org>,
linux-perf-users <linux-perf-users@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
CC: Zhen Lei <thunder.leizhen@...wei.com>
Subject: [PATCH] perf/core: Add missing device_remove_file() in pmu_dev_alloc()
The device attribute file 'nr_addr_filters' should be removed when
sysfs_update_groups() fails.
Fixes: f3a3a8257e5a ("perf/core: Add attr_groups_update into struct pmu")
Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
---
kernel/events/core.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 464917096e73..7d465584445b 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10980,11 +10980,15 @@ static int pmu_dev_alloc(struct pmu *pmu)
ret = sysfs_update_groups(&pmu->dev->kobj, pmu->attr_update);
if (ret)
- goto del_dev;
+ goto remove_file;
out:
return ret;
+remove_file:
+ if (pmu->nr_addr_filters)
+ device_remove_file(pmu->dev, &dev_attr_nr_addr_filters);
+
del_dev:
device_del(pmu->dev);
--
2.25.1
Powered by blists - more mailing lists