diff mbox

[1/2] cpupower: Fix bug where return value was not used

Message ID 20170620070241.21434.57148.stgit@Diesel2540.amd.com (mailing list archive)
State Mainlined
Delegated to: Rafael Wysocki
Headers show

Commit Message

Sherry Hurwitz June 20, 2017, 7:07 a.m. UTC
Save return value from amd_pci_get_num_boost_states
and remove redundant setting of *support

Signed-off-by: Sherry Hurwitz <sherry.hurwitz@amd.com>
---
 tools/power/cpupower/utils/helpers/misc.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Thomas Renninger June 23, 2017, 2 p.m. UTC | #1
On Tuesday, June 20, 2017 02:07:37 AM Sherry Hurwitz wrote:
> Save return value from amd_pci_get_num_boost_states
> and remove redundant setting of *support
> 
> Signed-off-by: Sherry Hurwitz <sherry.hurwitz@amd.com>

Acked-by: Thomas Renninger <trenn@suse.com>
Reviewed-by: Thomas Renninger <trenn@suse.com>
whatever is more appropriate or both...

Thanks, good catch!

Rafael can you queue this an the next one, please?

Thanks,

     Thomas

> ---
>  tools/power/cpupower/utils/helpers/misc.c |    5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/power/cpupower/utils/helpers/misc.c 
b/tools/power/cpupower/utils/helpers/misc.c
> index 1609243..6952a6a 100644
> --- a/tools/power/cpupower/utils/helpers/misc.c
> +++ b/tools/power/cpupower/utils/helpers/misc.c
> @@ -16,10 +16,9 @@ int cpufreq_has_boost_support(unsigned int cpu, int 
*support, int *active,
>  
>  	if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_CBP) {
>  		*support = 1;
> -		amd_pci_get_num_boost_states(active, states);
> -		if (ret <= 0)
> +		ret = amd_pci_get_num_boost_states(active, states);
> +		if (ret)
>  			return ret;
> -		*support = 1;
>  	} else if (cpupower_cpu_info.caps & CPUPOWER_CAP_INTEL_IDA)
>  		*support = *active = 1;
>  	return 0;
> 
>
Rafael J. Wysocki June 23, 2017, 11:03 p.m. UTC | #2
On Friday, June 23, 2017 04:00:57 PM Thomas Renninger wrote:
> On Tuesday, June 20, 2017 02:07:37 AM Sherry Hurwitz wrote:
> > Save return value from amd_pci_get_num_boost_states
> > and remove redundant setting of *support
> > 
> > Signed-off-by: Sherry Hurwitz <sherry.hurwitz@amd.com>
> 
> Acked-by: Thomas Renninger <trenn@suse.com>
> Reviewed-by: Thomas Renninger <trenn@suse.com>
> whatever is more appropriate or both...
> 
> Thanks, good catch!
> 
> Rafael can you queue this an the next one, please?

I'll do that.

Thanks,
Rafael
diff mbox

Patch

diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c
index 1609243..6952a6a 100644
--- a/tools/power/cpupower/utils/helpers/misc.c
+++ b/tools/power/cpupower/utils/helpers/misc.c
@@ -16,10 +16,9 @@  int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active,
 
 	if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_CBP) {
 		*support = 1;
-		amd_pci_get_num_boost_states(active, states);
-		if (ret <= 0)
+		ret = amd_pci_get_num_boost_states(active, states);
+		if (ret)
 			return ret;
-		*support = 1;
 	} else if (cpupower_cpu_info.caps & CPUPOWER_CAP_INTEL_IDA)
 		*support = *active = 1;
 	return 0;