[PATCH] platform/x86: pmc_atom: drop the PCI device reference after setup

From: Wentao Liang

Date: Tue Nov 03 2026 - 06:34:52 EST


for_each_pci_dev() walks the bus using pci_get_device(), which takes a
reference on every device it returns. pmc_atom_init() returns as soon
as the PMC device has been matched, without dropping that reference, so
the pci_dev is never released.

Save the setup result, release the reference and then return the saved
value.

Fixes: 93e5eadd1f6e ("x86/platform: New Intel Atom SOC power management controller driver")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/platform/x86/pmc_atom.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c
index 046933f6d1b6..ac19830703de 100644
--- a/drivers/platform/x86/pmc_atom.c
+++ b/drivers/platform/x86/pmc_atom.c
@@ -579,6 +579,7 @@ static int __init pmc_atom_init(void)
{
struct pci_dev *pdev = NULL;
const struct pci_device_id *ent;
+ int ret;

/*
* We look for our device - PCU PMC.
@@ -591,8 +592,11 @@ static int __init pmc_atom_init(void)
*/
for_each_pci_dev(pdev) {
ent = pci_match_id(pmc_pci_ids, pdev);
- if (ent)
- return pmc_setup_dev(pdev, ent);
+ if (ent) {
+ ret = pmc_setup_dev(pdev, ent);
+ pci_dev_put(pdev);
+ return ret;
+ }
}
/* Device not found */
return -ENODEV;
--
2.34.1