diff mbox series

opal: reserve_mem: remove unused variable 'i' and move scope of variable 'value'

Message ID 20180123121641.20689-1-colin.king@canonical.com
State Accepted
Headers show
Series opal: reserve_mem: remove unused variable 'i' and move scope of variable 'value' | expand

Commit Message

Colin Ian King Jan. 23, 2018, 12:16 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Minor code cleanups; variable i is assiged but never read, so it can be removed.
Move the scope of variable value into the while loop.

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

Comments

Alex Hung Jan. 24, 2018, 3:40 a.m. UTC | #1
On 2018-01-23 04:16 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Minor code cleanups; variable i is assiged but never read, so it can be removed.
> Move the scope of variable value into the while loop.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/opal/reserv_mem.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/src/opal/reserv_mem.c b/src/opal/reserv_mem.c
> index f31e9652..4683f73c 100644
> --- a/src/opal/reserv_mem.c
> +++ b/src/opal/reserv_mem.c
> @@ -57,9 +57,7 @@ static int get_config(fwts_framework *fw,
>   {
>   	FILE *file;
>   	char *p;
> -	uint64_t value;
>   	char line[MAXBUF];
> -	int i = 0;
>   
>   	file = fopen(filename, "r");
>   	if (!file) {
> @@ -71,6 +69,7 @@ static int get_config(fwts_framework *fw,
>   
>   	while (fgets(line, sizeof(line), file) != NULL) {
>   		char *cfline;
> +		uint64_t value;
>   
>   		cfline = strstr((char *)line, DELIM);
>   		cfline = cfline + strlen(DELIM);
> @@ -82,8 +81,6 @@ static int get_config(fwts_framework *fw,
>   			configstruct->occ_common = value;
>   		else if (strstr(line, "slw-image"))
>   			configstruct->slw = value;
> -
> -		i++;
>   	}
>   	fclose(file);
>   
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Jan. 24, 2018, 7:09 a.m. UTC | #2
On 01/23/2018 08:16 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Minor code cleanups; variable i is assiged but never read, so it can be removed.
> Move the scope of variable value into the while loop.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/opal/reserv_mem.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/src/opal/reserv_mem.c b/src/opal/reserv_mem.c
> index f31e9652..4683f73c 100644
> --- a/src/opal/reserv_mem.c
> +++ b/src/opal/reserv_mem.c
> @@ -57,9 +57,7 @@ static int get_config(fwts_framework *fw,
>   {
>   	FILE *file;
>   	char *p;
> -	uint64_t value;
>   	char line[MAXBUF];
> -	int i = 0;
>   
>   	file = fopen(filename, "r");
>   	if (!file) {
> @@ -71,6 +69,7 @@ static int get_config(fwts_framework *fw,
>   
>   	while (fgets(line, sizeof(line), file) != NULL) {
>   		char *cfline;
> +		uint64_t value;
>   
>   		cfline = strstr((char *)line, DELIM);
>   		cfline = cfline + strlen(DELIM);
> @@ -82,8 +81,6 @@ static int get_config(fwts_framework *fw,
>   			configstruct->occ_common = value;
>   		else if (strstr(line, "slw-image"))
>   			configstruct->slw = value;
> -
> -		i++;
>   	}
>   	fclose(file);
>   
> 

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

Patch

diff --git a/src/opal/reserv_mem.c b/src/opal/reserv_mem.c
index f31e9652..4683f73c 100644
--- a/src/opal/reserv_mem.c
+++ b/src/opal/reserv_mem.c
@@ -57,9 +57,7 @@  static int get_config(fwts_framework *fw,
 {
 	FILE *file;
 	char *p;
-	uint64_t value;
 	char line[MAXBUF];
-	int i = 0;
 
 	file = fopen(filename, "r");
 	if (!file) {
@@ -71,6 +69,7 @@  static int get_config(fwts_framework *fw,
 
 	while (fgets(line, sizeof(line), file) != NULL) {
 		char *cfline;
+		uint64_t value;
 
 		cfline = strstr((char *)line, DELIM);
 		cfline = cfline + strlen(DELIM);
@@ -82,8 +81,6 @@  static int get_config(fwts_framework *fw,
 			configstruct->occ_common = value;
 		else if (strstr(line, "slw-image"))
 			configstruct->slw = value;
-
-		i++;
 	}
 	fclose(file);