diff mbox

uefi: uefirtvariable: clean up cppcheck style warning

Message ID 1438761027-16045-1-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Aug. 5, 2015, 7:50 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

cppcheck found a minor style issue:

[src/uefi/uefirtvariable/uefirtvariable.c:470]:
  (style) The scope of the variable 'ioret' can be reduced.

Clean this up.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/uefi/uefirtvariable/uefirtvariable.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ivan Hu Aug. 6, 2015, 7:14 a.m. UTC | #1
On 2015年08月05日 15:50, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> cppcheck found a minor style issue:
>
> [src/uefi/uefirtvariable/uefirtvariable.c:470]:
>    (style) The scope of the variable 'ioret' can be reduced.
>
> Clean this up.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/uefi/uefirtvariable/uefirtvariable.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index e59e005..b3c7559 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -467,7 +467,6 @@ static bool strlen_valid(const uint16_t *variablename, const uint64_t variablena
>   
>   static int getnextvariable_test2(fwts_framework *fw)
>   {
> -	long ioret;
>   	uint64_t status;
>   
>   	struct efi_getnextvariablename getnextvariablename;
> @@ -494,6 +493,8 @@ static int getnextvariable_test2(fwts_framework *fw)
>   	 */
>   	variablename[0] = '\0';
>   	while (true) {
> +		long ioret;
> +
>   		variablenamesize = maxvariablenamesize;
>   		ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTVARIABLENAME, &getnextvariablename);
>   
Acked-by: Ivan Hu <ivan.hu@canonical.com>
Alex Hung Aug. 6, 2015, 9:18 a.m. UTC | #2
On 08/05/2015 03:50 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> cppcheck found a minor style issue:
> 
> [src/uefi/uefirtvariable/uefirtvariable.c:470]:
>   (style) The scope of the variable 'ioret' can be reduced.
> 
> Clean this up.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/uefi/uefirtvariable/uefirtvariable.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index e59e005..b3c7559 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -467,7 +467,6 @@ static bool strlen_valid(const uint16_t *variablename, const uint64_t variablena
>  
>  static int getnextvariable_test2(fwts_framework *fw)
>  {
> -	long ioret;
>  	uint64_t status;
>  
>  	struct efi_getnextvariablename getnextvariablename;
> @@ -494,6 +493,8 @@ static int getnextvariable_test2(fwts_framework *fw)
>  	 */
>  	variablename[0] = '\0';
>  	while (true) {
> +		long ioret;
> +
>  		variablenamesize = maxvariablenamesize;
>  		ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTVARIABLENAME, &getnextvariablename);
>  
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
index e59e005..b3c7559 100644
--- a/src/uefi/uefirtvariable/uefirtvariable.c
+++ b/src/uefi/uefirtvariable/uefirtvariable.c
@@ -467,7 +467,6 @@  static bool strlen_valid(const uint16_t *variablename, const uint64_t variablena
 
 static int getnextvariable_test2(fwts_framework *fw)
 {
-	long ioret;
 	uint64_t status;
 
 	struct efi_getnextvariablename getnextvariablename;
@@ -494,6 +493,8 @@  static int getnextvariable_test2(fwts_framework *fw)
 	 */
 	variablename[0] = '\0';
 	while (true) {
+		long ioret;
+
 		variablenamesize = maxvariablenamesize;
 		ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTVARIABLENAME, &getnextvariablename);