From: sashiko-bot@kernel.org
To: Vastargazing <vebohr@gmail.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 4/5] perf: arm: pmu: fix reference leak on failed device registration
Date: Mon, 04 May 2026 11:47:23 +0000 [thread overview]
Message-ID: <20260504114723.D4B0EC2BCB8@smtp.kernel.org> (raw)
In-Reply-To: <243cb3737b41fae32a09117c17809a210395e69f.1777889235.git.vebohr@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Calling `platform_device_put()` on statically allocated platform devices triggers a kernel WARNING.
--
commit 3c982eab6d069fa3cf3109dda88a31b66ceb0afd
Author: Vastargazing <vebohr@gmail.com>
perf: arm: pmu: fix reference leak on failed device registration
When platform_device_register() fails in arm_acpi_register_pmu_device(),
this commit adds a call to platform_device_put() in the error branch to
prevent a reference leak.
> diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c
> index e80f76d95e68..c2defbc32ad9 100644
> --- a/drivers/perf/arm_pmu_acpi.c
> +++ b/drivers/perf/arm_pmu_acpi.c
> @@ -119,8 +119,10 @@ arm_acpi_register_pmu_device(struct platform_device *pdev, u8 len,
>
> pdev->resource[0].start = irq;
> ret = platform_device_register(pdev);
> - if (ret)
> + if (ret) {
> + platform_device_put(pdev);
Because the devices passed to this function (spe_dev and trbe_dev) are
statically allocated and do not provide a .dev.release callback, will calling
platform_device_put() trigger a kernel warning?
When the reference count drops to 0, device_release() is invoked.
Since no release function is defined for these static objects, it triggers
the driver core warning about lacking a release() function, which could panic
the system if panic_on_warn is configured.
The kernel documentation's advice to use platform_device_put() applies
to dynamically allocated devices, not statically allocated global variables.
> acpi_unregister_gsi(gsi);
> + }
>
> return ret;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1777889235.git.vebohr@gmail.com?part=4
next prev parent reply other threads:[~2026-05-04 11:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1777889235.git.vebohr@gmail.com>
2026-05-04 10:08 ` [PATCH 4/5] perf: arm: pmu: fix reference leak on failed device registration Vastargazing
2026-05-04 11:47 ` sashiko-bot [this message]
2026-05-05 8:50 ` Sudeep Holla
2026-05-05 10:36 ` [PATCH 1/5] perf/arm_pmu_acpi: fix reference leak in arm_pmu_acpi_probe error path Valery Borovsky
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=20260504114723.D4B0EC2BCB8@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko@lists.linux.dev \
--cc=vebohr@gmail.com \
/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