Message ID | 1421175905-17035-4-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 01/14/2015 03:04 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > cppcheck is picking up some minor style issues which can > be easily fixed: > > [src/acpi/brightness/autobrightness.c:161]: > (style) The scope of the variable 'j' can be reduced. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpi/brightness/autobrightness.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/acpi/brightness/autobrightness.c b/src/acpi/brightness/autobrightness.c > index 1d94b0e..2bd435a 100644 > --- a/src/acpi/brightness/autobrightness.c > +++ b/src/acpi/brightness/autobrightness.c > @@ -158,9 +158,11 @@ static int auto_brightness_test2(fwts_framework *fw) > > /* Find the ranges of the failed levels */ > for (i = 0; i <= max_brightness; i++) { > - int j, end = i; > + int end = i; > > if (brightness_fail[i]) { > + int j; > + > /* Scan until we don't find a failure */ > for (j = i; j <= max_brightness && brightness_fail[j]; j++) > end = j; > Acked-by: Ivan Hu <ivan.hu@canonical.com>
On Thu, Jan 15, 2015 at 3:28 PM, IvanHu <ivan.hu@canonical.com> wrote: > On 01/14/2015 03:04 AM, Colin King wrote: >> >> From: Colin Ian King <colin.king@canonical.com> >> >> cppcheck is picking up some minor style issues which can >> be easily fixed: >> >> [src/acpi/brightness/autobrightness.c:161]: >> (style) The scope of the variable 'j' can be reduced. >> >> Signed-off-by: Colin Ian King <colin.king@canonical.com> >> --- >> src/acpi/brightness/autobrightness.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/src/acpi/brightness/autobrightness.c >> b/src/acpi/brightness/autobrightness.c >> index 1d94b0e..2bd435a 100644 >> --- a/src/acpi/brightness/autobrightness.c >> +++ b/src/acpi/brightness/autobrightness.c >> @@ -158,9 +158,11 @@ static int auto_brightness_test2(fwts_framework *fw) >> >> /* Find the ranges of the failed levels */ >> for (i = 0; i <= max_brightness; i++) { >> - int j, end = i; >> + int end = i; >> >> if (brightness_fail[i]) { >> + int j; >> + >> /* Scan until we don't find a >> failure */ >> for (j = i; j <= max_brightness && >> brightness_fail[j]; j++) >> end = j; >> > > Acked-by: Ivan Hu <ivan.hu@canonical.com> > Acked-by: Keng-Yu Lin <kengyu@canonical.com>
diff --git a/src/acpi/brightness/autobrightness.c b/src/acpi/brightness/autobrightness.c index 1d94b0e..2bd435a 100644 --- a/src/acpi/brightness/autobrightness.c +++ b/src/acpi/brightness/autobrightness.c @@ -158,9 +158,11 @@ static int auto_brightness_test2(fwts_framework *fw) /* Find the ranges of the failed levels */ for (i = 0; i <= max_brightness; i++) { - int j, end = i; + int end = i; if (brightness_fail[i]) { + int j; + /* Scan until we don't find a failure */ for (j = i; j <= max_brightness && brightness_fail[j]; j++) end = j;