diff mbox

efi: uefirtvariable: fix build error on Ubuntu Precise

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

Commit Message

Colin Ian King March 4, 2015, 9:03 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Initialise return value in ret, fixes build warning from gcc:

uefi/uefirtvariable/uefirtvariable.c: In function 'getnextvariable_test1':
uefi/uefirtvariable/uefirtvariable.c:302:6: error: 'ret' may be used
  uninitialized in this function [-Werror=uninitialized]
cc1: all warnings being treated as errors
make[4]: *** [uefi/uefirtvariable/fwts-uefirtvariable.o] Error 1

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

Comments

Ivan Hu March 4, 2015, 9:09 a.m. UTC | #1
On 2015年03月04日 17:03, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Initialise return value in ret, fixes build warning from gcc:
>
> uefi/uefirtvariable/uefirtvariable.c: In function 'getnextvariable_test1':
> uefi/uefirtvariable/uefirtvariable.c:302:6: error: 'ret' may be used
>    uninitialized in this function [-Werror=uninitialized]
> cc1: all warnings being treated as errors
> make[4]: *** [uefi/uefirtvariable/fwts-uefirtvariable.o] Error 1
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/uefi/uefirtvariable/uefirtvariable.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index ee41144..d47f50e 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -299,7 +299,7 @@ static int getnextvariable_test1(fwts_framework *fw)
>   	uint16_t *variablename;
>   	EFI_GUID vendorguid;
>   	bool found_name = false, found_guid = false;
> -	int ret;
> +	int ret = FWTS_OK;
>   
>   	for (dataindex = 0; dataindex < datasize; dataindex++)
>   		data[dataindex] = (uint8_t)dataindex;
Thanks! Colin.

Acked-by: Ivan Hu <ivan.hu@canonical.com>
Alex Hung March 5, 2015, 6:43 a.m. UTC | #2
On 03/04/2015 05:03 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Initialise return value in ret, fixes build warning from gcc:
> 
> uefi/uefirtvariable/uefirtvariable.c: In function 'getnextvariable_test1':
> uefi/uefirtvariable/uefirtvariable.c:302:6: error: 'ret' may be used
>   uninitialized in this function [-Werror=uninitialized]
> cc1: all warnings being treated as errors
> make[4]: *** [uefi/uefirtvariable/fwts-uefirtvariable.o] Error 1
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/uefi/uefirtvariable/uefirtvariable.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index ee41144..d47f50e 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -299,7 +299,7 @@ static int getnextvariable_test1(fwts_framework *fw)
>  	uint16_t *variablename;
>  	EFI_GUID vendorguid;
>  	bool found_name = false, found_guid = false;
> -	int ret;
> +	int ret = FWTS_OK;
>  
>  	for (dataindex = 0; dataindex < datasize; dataindex++)
>  		data[dataindex] = (uint8_t)dataindex;
> 

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 ee41144..d47f50e 100644
--- a/src/uefi/uefirtvariable/uefirtvariable.c
+++ b/src/uefi/uefirtvariable/uefirtvariable.c
@@ -299,7 +299,7 @@  static int getnextvariable_test1(fwts_framework *fw)
 	uint16_t *variablename;
 	EFI_GUID vendorguid;
 	bool found_name = false, found_guid = false;
-	int ret;
+	int ret = FWTS_OK;
 
 	for (dataindex = 0; dataindex < datasize; dataindex++)
 		data[dataindex] = (uint8_t)dataindex;