ACK: [PATCH] acpi: battery: clean up source, no functional change

Alex Hung alex.hung at canonical.com
Thu May 21 23:07:38 UTC 2015


On 05/15/2015 03:36 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> cppcheck was complaining about being able to reduce the scope
> of new_variable:
> 
> [src/acpi/battery/battery.c:157]: (style) The scope of the
>   variable 'new_value' can be reduced.
> 
> ..so move the declaration.  Also re-format the spacing in
> an ancient for loop
> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/acpi/battery/battery.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/acpi/battery/battery.c b/src/acpi/battery/battery.c
> index d216b32..bd4e257 100644
> --- a/src/acpi/battery/battery.c
> +++ b/src/acpi/battery/battery.c
> @@ -154,14 +154,15 @@ static void check_discharging(fwts_framework *fw, int index, char *name)
>  {
>  	int i;
>  	/* when we get here we KNOW the state is "discharging" */
> -	uint32_t initial_value, new_value;
> +	uint32_t initial_value;
>  
>  	fwts_printf(fw, "==== Waiting to see if battery '%s' discharges ====\n", name);
>  	fwts_cpu_consume_start();
>  
>  	initial_value = get_full(fw, index);
> -	for (i=0; i<=120; i++) {
> -		new_value = get_full(fw, index);
> +	for (i = 0; i <= 120; i++) {
> +		uint32_t new_value = get_full(fw, index);
> +
>  		if (new_value<initial_value) {
>  			fwts_passed(fw, "Battery %s charge is decrementing as expected.", name);
>  			fwts_cpu_consume_complete();
> 


Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list