[PATCH 12/46] acpi: s3: reduce scope of variables

Keng-Yu Lin keng-yu.lin at canonical.com
Tue Jan 20 06:50:40 UTC 2015


On Wed, Jan 14, 2015 at 3:04 AM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> cppcheck is picking up some minor style issues which can
> be easily fixed:
>
> [src/acpi/s3/s3.c:156]:
>         (style) The scope of the variable 'buffer' can be reduced.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/acpi/s3/s3.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
> index 7aa420d..8cf76f0 100644
> --- a/src/acpi/s3/s3.c
> +++ b/src/acpi/s3/s3.c
> @@ -153,8 +153,6 @@ static int s3_do_suspend_resume(fwts_framework *fw,
>         _cleanup_free_ char *command = NULL;
>         _cleanup_free_ char *quirks = NULL;
>         _cleanup_free_pm_vars_ fwts_pm_method_vars * fwts_settings = NULL;
> -       char buffer[80];
> -
>
>         int (*do_suspend)(fwts_pm_method_vars *, const int, int*, const char*);
>
> @@ -231,7 +229,9 @@ static int s3_do_suspend_resume(fwts_framework *fw,
>         if (s3_device_check) {
>                 int i;
>
> -               for (i=0;i<s3_device_check_delay;i++) {
> +               for (i = 0;i < s3_device_check_delay; i++) {
> +                       char buffer[80];
> +
>                         snprintf(buffer, sizeof(buffer), "(Waiting %d/%d seconds)", i+1,s3_device_check_delay);
>                         fwts_progress_message(fw, percent, buffer);
>                         sleep(1);
> --
> 2.1.4
>
>

Acked-by: Keng-Yu Lin <kengyu at canonical.com>



More information about the fwts-devel mailing list