From: Johan Hovold Date: Mon, 21 Jul 2025 15:36:09 +0000 (+0200) Subject: PCI/pwrctrl: Fix device leak at device stop X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=dc32e9346b26ba33e84ec3034a1e53a9733700f9;p=users%2Fhch%2Fmisc.git PCI/pwrctrl: Fix device leak at device stop Make sure to drop the reference to the pwrctrl device taken by of_find_device_by_node() when stopping a PCI device. Fixes: 681725afb6b9 ("PCI/pwrctl: Remove pwrctl device without iterating over all children of pwrctl parent") Signed-off-by: Johan Hovold Signed-off-by: Bjorn Helgaas Reviewed-by: Manivannan Sadhasivam Cc: stable@vger.kernel.org # v6.13 Link: https://patch.msgid.link/20250721153609.8611-4-johan+linaro@kernel.org --- diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index 445afdfa6498..16f21edbc29d 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c @@ -31,6 +31,8 @@ static void pci_pwrctrl_unregister(struct device *dev) return; of_device_unregister(pdev); + put_device(&pdev->dev); + of_node_clear_flag(np, OF_POPULATED); }