All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: hp-wmi: simplify the return expression of platform_profile_omen_set()
@ 2022-05-05  2:19 cgel.zte
  2022-05-06 10:18 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-05-05  2:19 UTC (permalink / raw)
  To: hdegoede
  Cc: markgross, platform-driver-x86, linux-kernel, Minghao Chi, Zeal Robot

From: Minghao Chi <chi.minghao@zte.com.cn>

Simplify the return expression.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 drivers/platform/x86/hp-wmi.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 667f94bba905..9edb1f877189 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -1119,7 +1119,7 @@ static int platform_profile_omen_get(struct platform_profile_handler *pprof,
 static int platform_profile_omen_set(struct platform_profile_handler *pprof,
 				     enum platform_profile_option profile)
 {
-	int err, tp, tp_version;
+	int tp, tp_version;
 
 	tp_version = omen_get_thermal_policy_version();
 
@@ -1149,11 +1149,7 @@ static int platform_profile_omen_set(struct platform_profile_handler *pprof,
 		return -EOPNOTSUPP;
 	}
 
-	err = omen_thermal_profile_set(tp);
-	if (err < 0)
-		return err;
-
-	return 0;
+	return omen_thermal_profile_set(tp);
 }
 
 static int thermal_profile_get(void)
-- 
2.25.1



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

* Re: [PATCH] platform/x86: hp-wmi: simplify the return expression of platform_profile_omen_set()
  2022-05-05  2:19 [PATCH] platform/x86: hp-wmi: simplify the return expression of platform_profile_omen_set() cgel.zte
@ 2022-05-06 10:18 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2022-05-06 10:18 UTC (permalink / raw)
  To: cgel.zte
  Cc: markgross, platform-driver-x86, linux-kernel, Minghao Chi, Zeal Robot

Hi,

On 5/5/22 04:19, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Simplify the return expression.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>

omen_thermal_profile_set(tp) returns the value of tp on
success which is not necessarily always 0, so this
patch is invalid.

Regards,

Hans



> ---
>  drivers/platform/x86/hp-wmi.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
> index 667f94bba905..9edb1f877189 100644
> --- a/drivers/platform/x86/hp-wmi.c
> +++ b/drivers/platform/x86/hp-wmi.c
> @@ -1119,7 +1119,7 @@ static int platform_profile_omen_get(struct platform_profile_handler *pprof,
>  static int platform_profile_omen_set(struct platform_profile_handler *pprof,
>  				     enum platform_profile_option profile)
>  {
> -	int err, tp, tp_version;
> +	int tp, tp_version;
>  
>  	tp_version = omen_get_thermal_policy_version();
>  
> @@ -1149,11 +1149,7 @@ static int platform_profile_omen_set(struct platform_profile_handler *pprof,
>  		return -EOPNOTSUPP;
>  	}
>  
> -	err = omen_thermal_profile_set(tp);
> -	if (err < 0)
> -		return err;
> -
> -	return 0;
> +	return omen_thermal_profile_set(tp);
>  }
>  
>  static int thermal_profile_get(void)


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

end of thread, other threads:[~2022-05-06 10:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05  2:19 [PATCH] platform/x86: hp-wmi: simplify the return expression of platform_profile_omen_set() cgel.zte
2022-05-06 10:18 ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.