diff mbox

[41/46] uefi: uefibootpath: reduce scope of variables

Message ID 1421175905-17035-42-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Jan. 13, 2015, 7:05 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

cppcheck is picking up some minor style issues which can
be easily fixed:

[src/uefi/uefibootpath/uefibootpath.c:737]:
	(style) The scope of the variable 'ret' can be reduced.

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

Comments

Ivan Hu Jan. 15, 2015, 7:39 a.m. UTC | #1
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/uefibootpath/uefibootpath.c:737]:
> 	(style) The scope of the variable 'ret' can be reduced.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/uefi/uefibootpath/uefibootpath.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/uefi/uefibootpath/uefibootpath.c b/src/uefi/uefibootpath/uefibootpath.c
> index 46c2455..1c11963 100644
> --- a/src/uefi/uefibootpath/uefibootpath.c
> +++ b/src/uefi/uefibootpath/uefibootpath.c
> @@ -734,7 +734,6 @@ static int uefibootpath_info_bootdev(fwts_framework *fw, fwts_uefi_var *var)
>   static void uefibootpath_var(fwts_framework *fw, fwts_uefi_var *var)
>   {
>   	char varname[512];
> -	int ret;
>
>   	fwts_uefi_get_varname(varname, sizeof(varname), var);
>
> @@ -742,6 +741,8 @@ static void uefibootpath_var(fwts_framework *fw, fwts_uefi_var *var)
>   	if ((strlen(varname) == 8) && (strncmp(varname, "Boot", 4) == 0)
>   			&& isxdigit(varname[4]) && isxdigit(varname[5])
>   			&& isxdigit(varname[6]) && isxdigit(varname[7])) {
> +		int ret;
> +
>   		fwts_log_info_verbatum(fw, "Name: %s", varname);
>   		errors = 0;
>   		ret = uefibootpath_info_bootdev(fw, var);
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>
Alex Hung Jan. 20, 2015, 8 a.m. UTC | #2
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/uefibootpath/uefibootpath.c:737]:
> 	(style) The scope of the variable 'ret' can be reduced.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/uefi/uefibootpath/uefibootpath.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/uefi/uefibootpath/uefibootpath.c b/src/uefi/uefibootpath/uefibootpath.c
> index 46c2455..1c11963 100644
> --- a/src/uefi/uefibootpath/uefibootpath.c
> +++ b/src/uefi/uefibootpath/uefibootpath.c
> @@ -734,7 +734,6 @@ static int uefibootpath_info_bootdev(fwts_framework *fw, fwts_uefi_var *var)
>  static void uefibootpath_var(fwts_framework *fw, fwts_uefi_var *var)
>  {
>  	char varname[512];
> -	int ret;
>  
>  	fwts_uefi_get_varname(varname, sizeof(varname), var);
>  
> @@ -742,6 +741,8 @@ static void uefibootpath_var(fwts_framework *fw, fwts_uefi_var *var)
>  	if ((strlen(varname) == 8) && (strncmp(varname, "Boot", 4) == 0)
>  			&& isxdigit(varname[4]) && isxdigit(varname[5])
>  			&& isxdigit(varname[6]) && isxdigit(varname[7])) {
> +		int ret;
> +
>  		fwts_log_info_verbatum(fw, "Name: %s", varname);
>  		errors = 0;
>  		ret = uefibootpath_info_bootdev(fw, var);
> 
Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/src/uefi/uefibootpath/uefibootpath.c b/src/uefi/uefibootpath/uefibootpath.c
index 46c2455..1c11963 100644
--- a/src/uefi/uefibootpath/uefibootpath.c
+++ b/src/uefi/uefibootpath/uefibootpath.c
@@ -734,7 +734,6 @@  static int uefibootpath_info_bootdev(fwts_framework *fw, fwts_uefi_var *var)
 static void uefibootpath_var(fwts_framework *fw, fwts_uefi_var *var)
 {
 	char varname[512];
-	int ret;
 
 	fwts_uefi_get_varname(varname, sizeof(varname), var);
 
@@ -742,6 +741,8 @@  static void uefibootpath_var(fwts_framework *fw, fwts_uefi_var *var)
 	if ((strlen(varname) == 8) && (strncmp(varname, "Boot", 4) == 0)
 			&& isxdigit(varname[4]) && isxdigit(varname[5])
 			&& isxdigit(varname[6]) && isxdigit(varname[7])) {
+		int ret;
+
 		fwts_log_info_verbatum(fw, "Name: %s", varname);
 		errors = 0;
 		ret = uefibootpath_info_bootdev(fw, var);