Message ID | 1421175905-17035-10-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/dmar/dmar.c:192]: > (style) The scope of the variable 'scope' can be reduced. > [src/acpi/dmar/dmar.c:193]: > (style) The scope of the variable 'ret' can be reduced. > [src/acpi/dmar/dmar.c:208]: > (style) The scope of the variable 'include_all' can be reduced. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpi/dmar/dmar.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c > index 329adc3..75aa337 100644 > --- a/src/acpi/dmar/dmar.c > +++ b/src/acpi/dmar/dmar.c > @@ -189,12 +189,9 @@ error: > static int acpi_parse_dev_scope(fwts_framework *fw, > uint8_t *start, uint8_t *end, const uint16_t seg) > { > - struct acpi_dev_scope *scope; > - int ret; > - > while (start < end) { > - scope = (struct acpi_dev_scope *)start; > - ret = acpi_parse_one_dev_scope(fw, scope, seg); > + struct acpi_dev_scope *scope = (struct acpi_dev_scope *)start; > + int ret = acpi_parse_one_dev_scope(fw, scope, seg); > if (ret) > return ret; > start += scope->length; > @@ -205,7 +202,6 @@ static int acpi_parse_dev_scope(fwts_framework *fw, > static int acpi_parse_one_drhd(fwts_framework *fw, > struct acpi_dmar_entry_header *header) > { > - static int include_all; > struct acpi_table_drhd *drhd = (struct acpi_table_drhd*)header; > > if (drhd->address & MASK_4K) { > @@ -214,6 +210,8 @@ static int acpi_parse_one_drhd(fwts_framework *fw, > return FWTS_ERROR; > } > if (drhd->flags & 1) { > + static int include_all; > + > if (include_all == 1) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, "MultipleDRHDSFlag", > "Multiple drhds have include_all flag set."); > Acked-by: Ivan Hu <ivan.hu@canonical.com>
On Wed, Jan 14, 2015 at 3:04 AM, Colin King <colin.king@canonical.com> wrote: > From: Colin Ian King <colin.king@canonical.com> > > cppcheck is picking up some minor style issues which can > be easily fixed: > > [src/acpi/dmar/dmar.c:192]: > (style) The scope of the variable 'scope' can be reduced. > [src/acpi/dmar/dmar.c:193]: > (style) The scope of the variable 'ret' can be reduced. > [src/acpi/dmar/dmar.c:208]: > (style) The scope of the variable 'include_all' can be reduced. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpi/dmar/dmar.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c > index 329adc3..75aa337 100644 > --- a/src/acpi/dmar/dmar.c > +++ b/src/acpi/dmar/dmar.c > @@ -189,12 +189,9 @@ error: > static int acpi_parse_dev_scope(fwts_framework *fw, > uint8_t *start, uint8_t *end, const uint16_t seg) > { > - struct acpi_dev_scope *scope; > - int ret; > - > while (start < end) { > - scope = (struct acpi_dev_scope *)start; > - ret = acpi_parse_one_dev_scope(fw, scope, seg); > + struct acpi_dev_scope *scope = (struct acpi_dev_scope *)start; > + int ret = acpi_parse_one_dev_scope(fw, scope, seg); > if (ret) > return ret; > start += scope->length; > @@ -205,7 +202,6 @@ static int acpi_parse_dev_scope(fwts_framework *fw, > static int acpi_parse_one_drhd(fwts_framework *fw, > struct acpi_dmar_entry_header *header) > { > - static int include_all; > struct acpi_table_drhd *drhd = (struct acpi_table_drhd*)header; > > if (drhd->address & MASK_4K) { > @@ -214,6 +210,8 @@ static int acpi_parse_one_drhd(fwts_framework *fw, > return FWTS_ERROR; > } > if (drhd->flags & 1) { > + static int include_all; > + > if (include_all == 1) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, "MultipleDRHDSFlag", > "Multiple drhds have include_all flag set."); > -- > 2.1.4 > > Acked-by: Keng-Yu Lin <kengyu@canonical.com>
diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c index 329adc3..75aa337 100644 --- a/src/acpi/dmar/dmar.c +++ b/src/acpi/dmar/dmar.c @@ -189,12 +189,9 @@ error: static int acpi_parse_dev_scope(fwts_framework *fw, uint8_t *start, uint8_t *end, const uint16_t seg) { - struct acpi_dev_scope *scope; - int ret; - while (start < end) { - scope = (struct acpi_dev_scope *)start; - ret = acpi_parse_one_dev_scope(fw, scope, seg); + struct acpi_dev_scope *scope = (struct acpi_dev_scope *)start; + int ret = acpi_parse_one_dev_scope(fw, scope, seg); if (ret) return ret; start += scope->length; @@ -205,7 +202,6 @@ static int acpi_parse_dev_scope(fwts_framework *fw, static int acpi_parse_one_drhd(fwts_framework *fw, struct acpi_dmar_entry_header *header) { - static int include_all; struct acpi_table_drhd *drhd = (struct acpi_table_drhd*)header; if (drhd->address & MASK_4K) { @@ -214,6 +210,8 @@ static int acpi_parse_one_drhd(fwts_framework *fw, return FWTS_ERROR; } if (drhd->flags & 1) { + static int include_all; + if (include_all == 1) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "MultipleDRHDSFlag", "Multiple drhds have include_all flag set.");