[v2,4/7] app/procinfo: remove useless assignment
Checks
Commit Message
'flag' is initialized to '0' but it is overwritten later, moving the
declaration where it is used and initialize with actual value.
Fixes: 0101a0ec6217 ("app/procinfo: add --show-mempool")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
app/proc-info/main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
Comments
On Wed, Nov 18, 2020 at 12:47 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> 'flag' is initialized to '0' but it is overwritten later, moving the
> declaration where it is used and initialize with actual value.
>
> Fixes: 0101a0ec6217 ("app/procinfo: add --show-mempool")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> app/proc-info/main.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/app/proc-info/main.c b/app/proc-info/main.c
> index dc5cc92209..b891622ccb 100644
> --- a/app/proc-info/main.c
> +++ b/app/proc-info/main.c
> @@ -1264,8 +1264,6 @@ show_ring(char *name)
> static void
> show_mempool(char *name)
> {
> - uint64_t flags = 0;
> -
> snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL ");
> STATS_BDR_STR(10, bdr_str);
>
> @@ -1273,8 +1271,8 @@ show_mempool(char *name)
> struct rte_mempool *ptr = rte_mempool_lookup(name);
> if (ptr != NULL) {
> struct rte_mempool_ops *ops;
> + uint64_t flags = ptr->flags;
Do we really need a temp storage?
But otherwise,
Reviewed-by: David Marchand <david.marchand@redhat.com>
>
> - flags = ptr->flags;
> ops = rte_mempool_get_ops(ptr->ops_index);
> printf(" - Name: %s on socket %d\n"
> " - flags:\n"
> --
> 2.26.2
>
@@ -1264,8 +1264,6 @@ show_ring(char *name)
static void
show_mempool(char *name)
{
- uint64_t flags = 0;
-
snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL ");
STATS_BDR_STR(10, bdr_str);
@@ -1273,8 +1271,8 @@ show_mempool(char *name)
struct rte_mempool *ptr = rte_mempool_lookup(name);
if (ptr != NULL) {
struct rte_mempool_ops *ops;
+ uint64_t flags = ptr->flags;
- flags = ptr->flags;
ops = rte_mempool_get_ops(ptr->ops_index);
printf(" - Name: %s on socket %d\n"
" - flags:\n"