diff mbox series

[RFT,v1,1/5] cpuidle: menu: Drop a redundant local variable

Message ID 13699686.uLZWGnKmhe@rjwysocki.net (mailing list archive)
State Queued
Delegated to: Rafael Wysocki
Headers show
Series cpuidle: menu: Avoid discarding useful information when processing recent idle intervals | expand

Commit Message

Rafael J. Wysocki Feb. 6, 2025, 2:22 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Local variable min in get_typical_interval() is updated, but never
accessed later, so drop it.

No functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpuidle/governors/menu.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Christian Loehle Feb. 6, 2025, 2:55 p.m. UTC | #1
On 2/6/25 14:22, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Local variable min in get_typical_interval() is updated, but never
> accessed later, so drop it.
> 
> No functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/cpuidle/governors/menu.c |    6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> --- a/drivers/cpuidle/governors/menu.c
> +++ b/drivers/cpuidle/governors/menu.c
> @@ -117,7 +117,7 @@
>  static unsigned int get_typical_interval(struct menu_device *data)
>  {
>  	int i, divisor;
> -	unsigned int min, max, thresh, avg;
> +	unsigned int max, thresh, avg;
>  	uint64_t sum, variance;
>  
>  	thresh = INT_MAX; /* Discard outliers above this value */
> @@ -125,7 +125,6 @@
>  again:
>  
>  	/* First calculate the average of past intervals */
> -	min = UINT_MAX;
>  	max = 0;
>  	sum = 0;
>  	divisor = 0;
> @@ -136,9 +135,6 @@
>  			divisor++;
>  			if (value > max)
>  				max = value;
> -
> -			if (value < min)
> -				min = value;
>  		}
>  	}
>  
> 
> 
> 

Reviewed-by: Christian Loehle <christian.loehle@arm.com>
diff mbox series

Patch

--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -117,7 +117,7 @@ 
 static unsigned int get_typical_interval(struct menu_device *data)
 {
 	int i, divisor;
-	unsigned int min, max, thresh, avg;
+	unsigned int max, thresh, avg;
 	uint64_t sum, variance;
 
 	thresh = INT_MAX; /* Discard outliers above this value */
@@ -125,7 +125,6 @@ 
 again:
 
 	/* First calculate the average of past intervals */
-	min = UINT_MAX;
 	max = 0;
 	sum = 0;
 	divisor = 0;
@@ -136,9 +135,6 @@ 
 			divisor++;
 			if (value > max)
 				max = value;
-
-			if (value < min)
-				min = value;
 		}
 	}