diff mbox series

cpufreq: tegra194: fix warning due to missing opp_put

Message ID 20230828120959.24680-1-sumitg@nvidia.com
State Superseded
Headers show
Series cpufreq: tegra194: fix warning due to missing opp_put | expand

Commit Message

Sumit Gupta Aug. 28, 2023, 12:09 p.m. UTC
Fix the warning due to missing dev_pm_opp_put() call and hence
wrong refcount value. This causes below warning message when
trying to remove the module.

 Call trace:
  dev_pm_opp_put_opp_table+0x154/0x15c
  dev_pm_opp_remove_table+0x34/0xa0
  _dev_pm_opp_cpumask_remove_table+0x7c/0xbc
  dev_pm_opp_of_cpumask_remove_table+0x10/0x18
  tegra194_cpufreq_exit+0x24/0x34 [tegra194_cpufreq]
  cpufreq_remove_dev+0xa8/0xf8
  subsys_interface_unregister+0x90/0xe8
  cpufreq_unregister_driver+0x54/0x9c
  tegra194_cpufreq_remove+0x18/0x2c [tegra194_cpufreq]
  platform_remove+0x24/0x74
  device_remove+0x48/0x78
  device_release_driver_internal+0xc8/0x160
  driver_detach+0x4c/0x90
  bus_remove_driver+0x68/0xb8
  driver_unregister+0x2c/0x58
  platform_driver_unregister+0x10/0x18
  tegra194_ccplex_driver_exit+0x14/0x1e0 [tegra194_cpufreq]
  __arm64_sys_delete_module+0x184/0x270

Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth")
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
---
 drivers/cpufreq/tegra194-cpufreq.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Viresh Kumar Aug. 29, 2023, 5:59 a.m. UTC | #1
On 28-08-23, 17:39, Sumit Gupta wrote:
> Fix the warning due to missing dev_pm_opp_put() call and hence
> wrong refcount value. This causes below warning message when
> trying to remove the module.
> 
>  Call trace:
>   dev_pm_opp_put_opp_table+0x154/0x15c
>   dev_pm_opp_remove_table+0x34/0xa0
>   _dev_pm_opp_cpumask_remove_table+0x7c/0xbc
>   dev_pm_opp_of_cpumask_remove_table+0x10/0x18
>   tegra194_cpufreq_exit+0x24/0x34 [tegra194_cpufreq]
>   cpufreq_remove_dev+0xa8/0xf8
>   subsys_interface_unregister+0x90/0xe8
>   cpufreq_unregister_driver+0x54/0x9c
>   tegra194_cpufreq_remove+0x18/0x2c [tegra194_cpufreq]
>   platform_remove+0x24/0x74
>   device_remove+0x48/0x78
>   device_release_driver_internal+0xc8/0x160
>   driver_detach+0x4c/0x90
>   bus_remove_driver+0x68/0xb8
>   driver_unregister+0x2c/0x58
>   platform_driver_unregister+0x10/0x18
>   tegra194_ccplex_driver_exit+0x14/0x1e0 [tegra194_cpufreq]
>   __arm64_sys_delete_module+0x184/0x270
> 
> Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth")
> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
> ---
>  drivers/cpufreq/tegra194-cpufreq.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
> index 88ef5e57ccd0..f63f7a6c2034 100644
> --- a/drivers/cpufreq/tegra194-cpufreq.c
> +++ b/drivers/cpufreq/tegra194-cpufreq.c
> @@ -454,6 +454,8 @@ static int tegra_cpufreq_init_cpufreq_table(struct cpufreq_policy *policy,

You need to put the OPP here, even if this fails.

>  		if (ret < 0)
>  			return ret;
>  
> +		dev_pm_opp_put(opp);
> +
>  		freq_table[j].driver_data = pos->driver_data;
>  		freq_table[j].frequency = pos->frequency;
>  		j++;
> -- 
> 2.17.1
Sumit Gupta Aug. 29, 2023, 8:45 a.m. UTC | #2
On 29/08/23 11:29, Viresh Kumar wrote:
> External email: Use caution opening links or attachments
> 
> 
> On 28-08-23, 17:39, Sumit Gupta wrote:
>> Fix the warning due to missing dev_pm_opp_put() call and hence
>> wrong refcount value. This causes below warning message when
>> trying to remove the module.
>>
>>   Call trace:
>>    dev_pm_opp_put_opp_table+0x154/0x15c
>>    dev_pm_opp_remove_table+0x34/0xa0
>>    _dev_pm_opp_cpumask_remove_table+0x7c/0xbc
>>    dev_pm_opp_of_cpumask_remove_table+0x10/0x18
>>    tegra194_cpufreq_exit+0x24/0x34 [tegra194_cpufreq]
>>    cpufreq_remove_dev+0xa8/0xf8
>>    subsys_interface_unregister+0x90/0xe8
>>    cpufreq_unregister_driver+0x54/0x9c
>>    tegra194_cpufreq_remove+0x18/0x2c [tegra194_cpufreq]
>>    platform_remove+0x24/0x74
>>    device_remove+0x48/0x78
>>    device_release_driver_internal+0xc8/0x160
>>    driver_detach+0x4c/0x90
>>    bus_remove_driver+0x68/0xb8
>>    driver_unregister+0x2c/0x58
>>    platform_driver_unregister+0x10/0x18
>>    tegra194_ccplex_driver_exit+0x14/0x1e0 [tegra194_cpufreq]
>>    __arm64_sys_delete_module+0x184/0x270
>>
>> Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth")
>> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
>> ---
>>   drivers/cpufreq/tegra194-cpufreq.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
>> index 88ef5e57ccd0..f63f7a6c2034 100644
>> --- a/drivers/cpufreq/tegra194-cpufreq.c
>> +++ b/drivers/cpufreq/tegra194-cpufreq.c
>> @@ -454,6 +454,8 @@ static int tegra_cpufreq_init_cpufreq_table(struct cpufreq_policy *policy,
> 
> You need to put the OPP here, even if this fails.
> 

Sent v2 with the change. Thank you for pointing.

Regards,
Sumit Gupta

>>                if (ret < 0)
>>                        return ret;
>>
>> +             dev_pm_opp_put(opp);
>> +
>>                freq_table[j].driver_data = pos->driver_data;
>>                freq_table[j].frequency = pos->frequency;
>>                j++;
>> --
>> 2.17.1
> 
> --
> viresh
diff mbox series

Patch

diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
index 88ef5e57ccd0..f63f7a6c2034 100644
--- a/drivers/cpufreq/tegra194-cpufreq.c
+++ b/drivers/cpufreq/tegra194-cpufreq.c
@@ -454,6 +454,8 @@  static int tegra_cpufreq_init_cpufreq_table(struct cpufreq_policy *policy,
 		if (ret < 0)
 			return ret;
 
+		dev_pm_opp_put(opp);
+
 		freq_table[j].driver_data = pos->driver_data;
 		freq_table[j].frequency = pos->frequency;
 		j++;