eal: fix unused-but-set-variable error

Message ID 20211029171410.330128-1-james.r.harris@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series eal: fix unused-but-set-variable error |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing fail Testing issues
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

Harris, James R Oct. 29, 2021, 5:14 p.m. UTC
  clang-13 rightfully complains that the total_mem
variable in eal_parse_socket_arg is set but not
used, since the final accumulated total_mem
result isn't used anywhere. So just remove the
total_mem variable.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
---
 lib/eal/linux/eal.c | 2 --
 1 file changed, 2 deletions(-)
  

Comments

David Marchand Oct. 29, 2021, 6:48 p.m. UTC | #1
On Fri, Oct 29, 2021 at 7:17 PM Jim Harris <james.r.harris@intel.com> wrote:
>
> clang-13 rightfully complains that the total_mem
> variable in eal_parse_socket_arg is set but not
> used, since the final accumulated total_mem
> result isn't used anywhere. So just remove the
> total_mem variable.
>

It was left behind by change:
Fixes: 0a703f0f36c1 ("eal/linux: fix parsing zero socket memory and limits")

> Signed-off-by: Jim Harris <james.r.harris@intel.com>
> ---
>  lib/eal/linux/eal.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
> index 81fdebc6a0..60b4924838 100644
> --- a/lib/eal/linux/eal.c
> +++ b/lib/eal/linux/eal.c
> @@ -562,7 +562,6 @@ eal_parse_socket_arg(char *strval, volatile uint64_t *socket_arg)
>         char * arg[RTE_MAX_NUMA_NODES];
>         char *end;
>         int arg_num, i, len;
> -       uint64_t total_mem = 0;
>
>         len = strnlen(strval, SOCKET_MEM_STRLEN);
>         if (len == SOCKET_MEM_STRLEN) {
> @@ -594,7 +593,6 @@ eal_parse_socket_arg(char *strval, volatile uint64_t *socket_arg)
>                                 (arg[i][0] == '\0') || (end == NULL) || (*end != '\0'))
>                         return -1;
>                 val <<= 20;
> -               total_mem += val;
>                 socket_arg[i] = val;
>         }
>


Reviewed-by: David Marchand <david.marchand@redhat.com>
  
David Marchand Nov. 4, 2021, 12:19 p.m. UTC | #2
On Fri, Oct 29, 2021 at 8:48 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> On Fri, Oct 29, 2021 at 7:17 PM Jim Harris <james.r.harris@intel.com> wrote:
> >
> > clang-13 rightfully complains that the total_mem
> > variable in eal_parse_socket_arg is set but not
> > used, since the final accumulated total_mem
> > result isn't used anywhere. So just remove the
> > total_mem variable.
>
> Fixes: 0a703f0f36c1 ("eal/linux: fix parsing zero socket memory and limits")
>
> > Signed-off-by: Jim Harris <james.r.harris@intel.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.
  

Patch

diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 81fdebc6a0..60b4924838 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -562,7 +562,6 @@  eal_parse_socket_arg(char *strval, volatile uint64_t *socket_arg)
 	char * arg[RTE_MAX_NUMA_NODES];
 	char *end;
 	int arg_num, i, len;
-	uint64_t total_mem = 0;
 
 	len = strnlen(strval, SOCKET_MEM_STRLEN);
 	if (len == SOCKET_MEM_STRLEN) {
@@ -594,7 +593,6 @@  eal_parse_socket_arg(char *strval, volatile uint64_t *socket_arg)
 				(arg[i][0] == '\0') || (end == NULL) || (*end != '\0'))
 			return -1;
 		val <<= 20;
-		total_mem += val;
 		socket_arg[i] = val;
 	}