Message ID | 1421175905-17035-46-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 01/14/2015 03:05 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/uefi/uefirtmisc/uefirtmisc.c:77]: > (style) The scope of the variable 'ioret' can be reduced. > [src/uefi/uefirtmisc/uefirtmisc.c:101]: > (style) The scope of the variable 'ioret' can be reduced. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/uefi/uefirtmisc/uefirtmisc.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/src/uefi/uefirtmisc/uefirtmisc.c b/src/uefi/uefirtmisc/uefirtmisc.c > index caafca5..a187674 100644 > --- a/src/uefi/uefirtmisc/uefirtmisc.c > +++ b/src/uefi/uefirtmisc/uefirtmisc.c > @@ -74,7 +74,6 @@ static int uefirtmisc_deinit(fwts_framework *fw) > > static int getnexthighmonotoniccount_test(fwts_framework *fw, uint32_t multitesttime) > { > - long ioret; > uint64_t status; > struct efi_getnexthighmonotoniccount getnexthighmonotoniccount; > uint32_t highcount; > @@ -84,7 +83,8 @@ static int getnexthighmonotoniccount_test(fwts_framework *fw, uint32_t multitest > getnexthighmonotoniccount.status = &status; > > for (i = 0; i < multitesttime; i++) { > - ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT, &getnexthighmonotoniccount); > + long ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT, &getnexthighmonotoniccount); > + > if (ioret == -1) { > fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetNextHighMonotonicCount", > "Failed to get high monotonic count with UEFI runtime service."); > @@ -98,7 +98,6 @@ static int getnexthighmonotoniccount_test(fwts_framework *fw, uint32_t multitest > > static int querycapsulecapabilities_test(fwts_framework *fw, uint32_t multitesttime, uint32_t flag) > { > - long ioret; > uint64_t status; > uint32_t i; > > @@ -123,7 +122,8 @@ static int querycapsulecapabilities_test(fwts_framework *fw, uint32_t multitestt > querycapsulecapabilities.ResetType = &resettype; > > for (i = 0; i < multitesttime; i++) { > - ioret = ioctl(fd, EFI_RUNTIME_QUERY_CAPSULECAPABILITIES, &querycapsulecapabilities); > + long ioret = ioctl(fd, EFI_RUNTIME_QUERY_CAPSULECAPABILITIES, &querycapsulecapabilities); > + > if (ioret == -1) { > if (status == EFI_UNSUPPORTED) { > fwts_skipped(fw, "Not support the UEFI QueryCapsuleCapabilities runtime interface" > Acked-by: Ivan Hu <ivan.hu@canonical.com>
On 01/14/2015 03:05 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/uefi/uefirtmisc/uefirtmisc.c:77]: > (style) The scope of the variable 'ioret' can be reduced. > [src/uefi/uefirtmisc/uefirtmisc.c:101]: > (style) The scope of the variable 'ioret' can be reduced. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/uefi/uefirtmisc/uefirtmisc.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/src/uefi/uefirtmisc/uefirtmisc.c b/src/uefi/uefirtmisc/uefirtmisc.c > index caafca5..a187674 100644 > --- a/src/uefi/uefirtmisc/uefirtmisc.c > +++ b/src/uefi/uefirtmisc/uefirtmisc.c > @@ -74,7 +74,6 @@ static int uefirtmisc_deinit(fwts_framework *fw) > > static int getnexthighmonotoniccount_test(fwts_framework *fw, uint32_t multitesttime) > { > - long ioret; > uint64_t status; > struct efi_getnexthighmonotoniccount getnexthighmonotoniccount; > uint32_t highcount; > @@ -84,7 +83,8 @@ static int getnexthighmonotoniccount_test(fwts_framework *fw, uint32_t multitest > getnexthighmonotoniccount.status = &status; > > for (i = 0; i < multitesttime; i++) { > - ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT, &getnexthighmonotoniccount); > + long ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT, &getnexthighmonotoniccount); > + > if (ioret == -1) { > fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetNextHighMonotonicCount", > "Failed to get high monotonic count with UEFI runtime service."); > @@ -98,7 +98,6 @@ static int getnexthighmonotoniccount_test(fwts_framework *fw, uint32_t multitest > > static int querycapsulecapabilities_test(fwts_framework *fw, uint32_t multitesttime, uint32_t flag) > { > - long ioret; > uint64_t status; > uint32_t i; > > @@ -123,7 +122,8 @@ static int querycapsulecapabilities_test(fwts_framework *fw, uint32_t multitestt > querycapsulecapabilities.ResetType = &resettype; > > for (i = 0; i < multitesttime; i++) { > - ioret = ioctl(fd, EFI_RUNTIME_QUERY_CAPSULECAPABILITIES, &querycapsulecapabilities); > + long ioret = ioctl(fd, EFI_RUNTIME_QUERY_CAPSULECAPABILITIES, &querycapsulecapabilities); > + > if (ioret == -1) { > if (status == EFI_UNSUPPORTED) { > fwts_skipped(fw, "Not support the UEFI QueryCapsuleCapabilities runtime interface" > Acked-by: Alex Hung <alex.hung@canonical.com>
diff --git a/src/uefi/uefirtmisc/uefirtmisc.c b/src/uefi/uefirtmisc/uefirtmisc.c index caafca5..a187674 100644 --- a/src/uefi/uefirtmisc/uefirtmisc.c +++ b/src/uefi/uefirtmisc/uefirtmisc.c @@ -74,7 +74,6 @@ static int uefirtmisc_deinit(fwts_framework *fw) static int getnexthighmonotoniccount_test(fwts_framework *fw, uint32_t multitesttime) { - long ioret; uint64_t status; struct efi_getnexthighmonotoniccount getnexthighmonotoniccount; uint32_t highcount; @@ -84,7 +83,8 @@ static int getnexthighmonotoniccount_test(fwts_framework *fw, uint32_t multitest getnexthighmonotoniccount.status = &status; for (i = 0; i < multitesttime; i++) { - ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT, &getnexthighmonotoniccount); + long ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT, &getnexthighmonotoniccount); + if (ioret == -1) { fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetNextHighMonotonicCount", "Failed to get high monotonic count with UEFI runtime service."); @@ -98,7 +98,6 @@ static int getnexthighmonotoniccount_test(fwts_framework *fw, uint32_t multitest static int querycapsulecapabilities_test(fwts_framework *fw, uint32_t multitesttime, uint32_t flag) { - long ioret; uint64_t status; uint32_t i; @@ -123,7 +122,8 @@ static int querycapsulecapabilities_test(fwts_framework *fw, uint32_t multitestt querycapsulecapabilities.ResetType = &resettype; for (i = 0; i < multitesttime; i++) { - ioret = ioctl(fd, EFI_RUNTIME_QUERY_CAPSULECAPABILITIES, &querycapsulecapabilities); + long ioret = ioctl(fd, EFI_RUNTIME_QUERY_CAPSULECAPABILITIES, &querycapsulecapabilities); + if (ioret == -1) { if (status == EFI_UNSUPPORTED) { fwts_skipped(fw, "Not support the UEFI QueryCapsuleCapabilities runtime interface"