diff mbox series

uefi: uefirtmisc: reduce scope of some variables

Message ID 20210922104015.179242-1-colin.king@canonical.com
State Accepted
Headers show
Series uefi: uefirtmisc: reduce scope of some variables | expand

Commit Message

Colin Ian King Sept. 22, 2021, 10:40 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Several variables are used in a deeper scope, move these to clean up
cppcheck style warnings.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/uefi/uefirtmisc/uefirtmisc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Alex Hung Sept. 22, 2021, 7:09 p.m. UTC | #1
On 2021-09-22 4:40 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Several variables are used in a deeper scope, move these to clean up
> cppcheck style warnings.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/uefi/uefirtmisc/uefirtmisc.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/src/uefi/uefirtmisc/uefirtmisc.c b/src/uefi/uefirtmisc/uefirtmisc.c
> index c00ed442..f6038f5f 100644
> --- a/src/uefi/uefirtmisc/uefirtmisc.c
> +++ b/src/uefi/uefirtmisc/uefirtmisc.c
> @@ -281,12 +281,13 @@ static int uefirtmisc_test3(fwts_framework *fw)
>  
>  static int uefirtmisc_test4(fwts_framework *fw)
>  {
> -	long ioret;
> -	uint64_t status;
> -	struct efi_getnexthighmonotoniccount getnexthighmonotoniccount;
> -	uint32_t highcount;
>  
>  	if (!(runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT)) {
> +		long ioret;
> +		uint64_t status;
> +		struct efi_getnexthighmonotoniccount getnexthighmonotoniccount;
> +		uint32_t highcount;
> +
>  		getnexthighmonotoniccount.HighCount = &highcount;
>  		getnexthighmonotoniccount.status = &status;
>  		status = ~0ULL;
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Sept. 23, 2021, 3:48 a.m. UTC | #2
On 9/22/21 6:40 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Several variables are used in a deeper scope, move these to clean up
> cppcheck style warnings.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/uefi/uefirtmisc/uefirtmisc.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/src/uefi/uefirtmisc/uefirtmisc.c b/src/uefi/uefirtmisc/uefirtmisc.c
> index c00ed442..f6038f5f 100644
> --- a/src/uefi/uefirtmisc/uefirtmisc.c
> +++ b/src/uefi/uefirtmisc/uefirtmisc.c
> @@ -281,12 +281,13 @@ static int uefirtmisc_test3(fwts_framework *fw)
>  
>  static int uefirtmisc_test4(fwts_framework *fw)
>  {
> -	long ioret;
> -	uint64_t status;
> -	struct efi_getnexthighmonotoniccount getnexthighmonotoniccount;
> -	uint32_t highcount;
>  
>  	if (!(runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT)) {
> +		long ioret;
> +		uint64_t status;
> +		struct efi_getnexthighmonotoniccount getnexthighmonotoniccount;
> +		uint32_t highcount;
> +
>  		getnexthighmonotoniccount.HighCount = &highcount;
>  		getnexthighmonotoniccount.status = &status;
>  		status = ~0ULL;
> 

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox series

Patch

diff --git a/src/uefi/uefirtmisc/uefirtmisc.c b/src/uefi/uefirtmisc/uefirtmisc.c
index c00ed442..f6038f5f 100644
--- a/src/uefi/uefirtmisc/uefirtmisc.c
+++ b/src/uefi/uefirtmisc/uefirtmisc.c
@@ -281,12 +281,13 @@  static int uefirtmisc_test3(fwts_framework *fw)
 
 static int uefirtmisc_test4(fwts_framework *fw)
 {
-	long ioret;
-	uint64_t status;
-	struct efi_getnexthighmonotoniccount getnexthighmonotoniccount;
-	uint32_t highcount;
 
 	if (!(runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT)) {
+		long ioret;
+		uint64_t status;
+		struct efi_getnexthighmonotoniccount getnexthighmonotoniccount;
+		uint32_t highcount;
+
 		getnexthighmonotoniccount.HighCount = &highcount;
 		getnexthighmonotoniccount.status = &status;
 		status = ~0ULL;