diff mbox series

[v2,14/16] cpufreq/amd-pstate: Drop ret variable from amd_pstate_set_energy_pref_index()

Message ID 20241208063031.3113-15-mario.limonciello@amd.com (mailing list archive)
State Superseded, archived
Headers show
Series amd-pstate fixes and improvements for 6.14 | expand

Commit Message

Mario Limonciello Dec. 8, 2024, 6:30 a.m. UTC
The ret variable is not necessary.

Reviewed-and-tested-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Gautham R. Shenoy Dec. 9, 2024, 9:25 a.m. UTC | #1
On Sun, Dec 08, 2024 at 12:30:29AM -0600, Mario Limonciello wrote:
> The ret variable is not necessary.
> 
> Reviewed-and-tested-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>


Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>

--
Thanks and Regards
gautham.
> ---
>  drivers/cpufreq/amd-pstate.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 2178931fbf87b..5869bcd287e87 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -318,13 +318,11 @@ static int shmem_set_epp(struct amd_cpudata *cpudata, u32 epp)
>  static int amd_pstate_set_energy_pref_index(struct amd_cpudata *cpudata,
>  		int pref_index)
>  {
> -	int epp = -EINVAL;
> -	int ret;
> +	int epp;
>  
>  	if (!pref_index)
>  		epp = cpudata->epp_default;
> -
> -	if (epp == -EINVAL)
> +	else
>  		epp = epp_values[pref_index];
>  
>  	if (epp > 0 && cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) {
> @@ -340,9 +338,7 @@ static int amd_pstate_set_energy_pref_index(struct amd_cpudata *cpudata,
>  					  cpudata->boost_state);
>  	}
>  
> -	ret = amd_pstate_set_epp(cpudata, epp);
> -
> -	return ret;
> +	return amd_pstate_set_epp(cpudata, epp);
>  }
>  
>  static inline int msr_cppc_enable(bool enable)
> -- 
> 2.43.0
>
diff mbox series

Patch

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 2178931fbf87b..5869bcd287e87 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -318,13 +318,11 @@  static int shmem_set_epp(struct amd_cpudata *cpudata, u32 epp)
 static int amd_pstate_set_energy_pref_index(struct amd_cpudata *cpudata,
 		int pref_index)
 {
-	int epp = -EINVAL;
-	int ret;
+	int epp;
 
 	if (!pref_index)
 		epp = cpudata->epp_default;
-
-	if (epp == -EINVAL)
+	else
 		epp = epp_values[pref_index];
 
 	if (epp > 0 && cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) {
@@ -340,9 +338,7 @@  static int amd_pstate_set_energy_pref_index(struct amd_cpudata *cpudata,
 					  cpudata->boost_state);
 	}
 
-	ret = amd_pstate_set_epp(cpudata, epp);
-
-	return ret;
+	return amd_pstate_set_epp(cpudata, epp);
 }
 
 static inline int msr_cppc_enable(bool enable)