From: Zhen Lei <thunder.leizhen@huawei.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>,
"Namhyung Kim" <namhyung@kernel.org>,
linux-perf-users <linux-perf-users@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Subject: [PATCH] perf/core: Add missing device_remove_file() in pmu_dev_alloc()
Date: Mon, 9 Aug 2021 11:49:41 +0800 [thread overview]
Message-ID: <20210809034941.2264-1-thunder.leizhen@huawei.com> (raw)
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@huawei.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
reply other threads:[~2021-08-09 3:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210809034941.2264-1-thunder.leizhen@huawei.com \
--to=thunder.leizhen@huawei.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®