[PATCH] cpufreq: tegra194: fix double-pointer error in get_cpu_ndiv

Xueqin Luo posted 1 patch 3 weeks, 5 days ago
drivers/cpufreq/tegra194-cpufreq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] cpufreq: tegra194: fix double-pointer error in get_cpu_ndiv
Posted by Xueqin Luo 3 weeks, 5 days ago
ndiv is already a u64 pointer, passing &ndiv to smp_call_function_single()
results in a u64** being written to instead of the caller's u64 variable,
so the caller always reads back an uninitialized ndiv.  Drop the spurious
'&'.

Fixes: 0839ed1fd7ac ("cpufreq: tegra194: add soc data to support multiple soc")
Signed-off-by: Xueqin Luo <luoxueqin@kylinos.cn>
---
 drivers/cpufreq/tegra194-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
index c6375e14d445..1eb96e9f3310 100644
--- a/drivers/cpufreq/tegra194-cpufreq.c
+++ b/drivers/cpufreq/tegra194-cpufreq.c
@@ -367,7 +367,7 @@ static void tegra194_get_cpu_ndiv_sysreg(void *ndiv)
 
 static int tegra194_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv)
 {
-	return smp_call_function_single(cpu, tegra194_get_cpu_ndiv_sysreg, &ndiv, true);
+	return smp_call_function_single(cpu, tegra194_get_cpu_ndiv_sysreg, ndiv, true);
 }
 
 static void tegra194_set_cpu_ndiv_sysreg(void *data)
-- 
2.43.0
Re: [PATCH] cpufreq: tegra194: fix double-pointer error in get_cpu_ndiv
Posted by Sumit Gupta 3 weeks, 4 days ago
On 31/08/26 13:00, Xueqin Luo wrote:
> External email: Use caution opening links or attachments
>
>
> ndiv is already a u64 pointer, passing &ndiv to smp_call_function_single()
> results in a u64** being written to instead of the caller's u64 variable,
> so the caller always reads back an uninitialized ndiv.  Drop the spurious
> '&'.
>
> Fixes: 0839ed1fd7ac ("cpufreq: tegra194: add soc data to support multiple soc")
> Signed-off-by: Xueqin Luo <luoxueqin@kylinos.cn>
> ---
>   drivers/cpufreq/tegra194-cpufreq.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
> index c6375e14d445..1eb96e9f3310 100644
> --- a/drivers/cpufreq/tegra194-cpufreq.c
> +++ b/drivers/cpufreq/tegra194-cpufreq.c
> @@ -367,7 +367,7 @@ static void tegra194_get_cpu_ndiv_sysreg(void *ndiv)
>
>   static int tegra194_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv)
>   {
> -       return smp_call_function_single(cpu, tegra194_get_cpu_ndiv_sysreg, &ndiv, true);
> +       return smp_call_function_single(cpu, tegra194_get_cpu_ndiv_sysreg, ndiv, true);
>   }
>
>   static void tegra194_set_cpu_ndiv_sysreg(void *data)
> --
> 2.43.0

Reviewed-by: Sumit Gupta <sumitg@nvidia.com>

Thanks,
Sumit
Re: [PATCH] cpufreq: tegra194: fix double-pointer error in get_cpu_ndiv
Posted by Viresh Kumar 3 weeks, 5 days ago
On 31-08-26, 15:30, Xueqin Luo wrote:
> ndiv is already a u64 pointer, passing &ndiv to smp_call_function_single()
> results in a u64** being written to instead of the caller's u64 variable,
> so the caller always reads back an uninitialized ndiv.  Drop the spurious
> '&'.
> 
> Fixes: 0839ed1fd7ac ("cpufreq: tegra194: add soc data to support multiple soc")
> Signed-off-by: Xueqin Luo <luoxueqin@kylinos.cn>
> ---
>  drivers/cpufreq/tegra194-cpufreq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied. Thanks.

-- 
viresh