linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq: nforce2: fix PCI device reference leaks in nforce2_fsb_read
@ 2025-09-02  7:02 Miaoqian Lin
  2025-09-02 11:21 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2025-09-02  7:02 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, linux-pm, linux-kernel; +Cc: linmq006, stable

Add missing pci_dev_put() calls to release device references
obtained via pci_get_subsys().

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/cpufreq/cpufreq-nforce2.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq-nforce2.c b/drivers/cpufreq/cpufreq-nforce2.c
index fedad1081973..0a49cb9d7ba1 100644
--- a/drivers/cpufreq/cpufreq-nforce2.c
+++ b/drivers/cpufreq/cpufreq-nforce2.c
@@ -148,13 +148,16 @@ static unsigned int nforce2_fsb_read(int bootfsb)
 	/* Check if PLL register is already set */
 	pci_read_config_byte(nforce2_dev, NFORCE2_PLLENABLE, (u8 *)&temp);
 
-	if (bootfsb || !temp)
+	if (bootfsb || !temp) {
+		pci_dev_put(nforce2_sub5);
 		return fsb;
+	}
 
 	/* Use PLL register FSB value */
 	pci_read_config_dword(nforce2_dev, NFORCE2_PLLREG, &temp);
 	fsb = nforce2_calc_fsb(temp);
 
+	pci_dev_put(nforce2_sub5);
 	return fsb;
 }
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cpufreq: nforce2: fix PCI device reference leaks in nforce2_fsb_read
  2025-09-02  7:02 [PATCH] cpufreq: nforce2: fix PCI device reference leaks in nforce2_fsb_read Miaoqian Lin
@ 2025-09-02 11:21 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2025-09-02 11:21 UTC (permalink / raw)
  To: Miaoqian Lin, linux-pm; +Cc: stable, LKML, Rafael J. Wysocki, Viresh Kumar

> Add missing pci_dev_put() calls to release device references
> obtained via pci_get_subsys().

* Would you like to complete the object clean-up by using a goto chain?

* How do you think about to increase the application of scope-based resource management?
  https://elixir.bootlin.com/linux/v6.17-rc4/source/include/linux/pci.h#L1208


Regards,
Markus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-02 11:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-02  7:02 [PATCH] cpufreq: nforce2: fix PCI device reference leaks in nforce2_fsb_read Miaoqian Lin
2025-09-02 11:21 ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).