diff mbox series

cpufreq: amd_freq_sensitivity: Add missing pci_dev_put()

Message ID 20221116113339.177740-1-wangxiongfeng2@huawei.com (mailing list archive)
State Mainlined, archived
Headers show
Series cpufreq: amd_freq_sensitivity: Add missing pci_dev_put() | expand

Commit Message

Xiongfeng Wang Nov. 16, 2022, 11:33 a.m. UTC
pci_get_device() will increase the reference count for the returned
pci_dev. We need to use pci_dev_put() to decrease the reference count
after using pci_get_device(). Let's add it.

Fixes: 59a3b3a8db16 ("cpufreq: AMD: Ignore the check for ProcFeedback in ST/CZ")
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
 drivers/cpufreq/amd_freq_sensitivity.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Rafael J. Wysocki Nov. 30, 2022, 6:51 p.m. UTC | #1
On Wed, Nov 16, 2022 at 12:15 PM Xiongfeng Wang
<wangxiongfeng2@huawei.com> wrote:
>
> pci_get_device() will increase the reference count for the returned
> pci_dev. We need to use pci_dev_put() to decrease the reference count
> after using pci_get_device(). Let's add it.
>
> Fixes: 59a3b3a8db16 ("cpufreq: AMD: Ignore the check for ProcFeedback in ST/CZ")
> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
> ---
>  drivers/cpufreq/amd_freq_sensitivity.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/cpufreq/amd_freq_sensitivity.c b/drivers/cpufreq/amd_freq_sensitivity.c
> index 6448e03bcf48..59b19b9975e8 100644
> --- a/drivers/cpufreq/amd_freq_sensitivity.c
> +++ b/drivers/cpufreq/amd_freq_sensitivity.c
> @@ -125,6 +125,8 @@ static int __init amd_freq_sensitivity_init(void)
>         if (!pcidev) {
>                 if (!boot_cpu_has(X86_FEATURE_PROC_FEEDBACK))
>                         return -ENODEV;
> +       } else {
> +               pci_dev_put(pcidev);
>         }
>
>         if (rdmsrl_safe(MSR_AMD64_FREQ_SENSITIVITY_ACTUAL, &val))
> --

Applied as 6.2 material, thanks!
diff mbox series

Patch

diff --git a/drivers/cpufreq/amd_freq_sensitivity.c b/drivers/cpufreq/amd_freq_sensitivity.c
index 6448e03bcf48..59b19b9975e8 100644
--- a/drivers/cpufreq/amd_freq_sensitivity.c
+++ b/drivers/cpufreq/amd_freq_sensitivity.c
@@ -125,6 +125,8 @@  static int __init amd_freq_sensitivity_init(void)
 	if (!pcidev) {
 		if (!boot_cpu_has(X86_FEATURE_PROC_FEEDBACK))
 			return -ENODEV;
+	} else {
+		pci_dev_put(pcidev);
 	}
 
 	if (rdmsrl_safe(MSR_AMD64_FREQ_SENSITIVITY_ACTUAL, &val))