[4/4] app/procinfo: remove useless assignment
Checks
Commit Message
'flag' initialized to '0' but it is overwritten later, initial
assignment can be removed.
Fixes: 0101a0ec6217 ("app/procinfo: add --show-mempool")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: vipin.varghese@intel.com
---
app/proc-info/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi Ferruh,
Thanks for the update
snipped
> show_mempool(char *name) {
> - uint64_t flags = 0;
> + uint64_t flags;
>
Checking the current code base it makes more sense to move the code inside `if` condition check. Sample code shared below
```
- uint64_t flags = 0;
snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL ");
STATS_BDR_STR(10, bdr_str);
if (name != NULL) {
struct rte_mempool *ptr = rte_mempool_lookup(name);
if (ptr != NULL) {
struct rte_mempool_ops *ops;
+ unsigned int flags = ptr->flags;
ops = rte_mempool_get_ops(ptr->ops_index);
```
But it is ok
On 11/17/2020 6:04 PM, Varghese, Vipin wrote:
> Hi Ferruh,
>
> Thanks for the update
>
> snipped
>> show_mempool(char *name) {
>> -uint64_t flags = 0;
>> +uint64_t flags;
>>
>
> Checking the current code base it makes more sense to move the code inside `if` condition check. Sample code shared below
>
> ```
> -uint64_t flags = 0;
>
> snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL ");
> STATS_BDR_STR(10, bdr_str);
>
> if (name != NULL) {
> struct rte_mempool *ptr = rte_mempool_lookup(name);
> if (ptr != NULL) {
> struct rte_mempool_ops *ops;
>
> +unsigned int flags = ptr->flags;
> ops = rte_mempool_get_ops(ptr->ops_index);
> ```
>
> But it is ok
>
I think both are OK, this is trivial, let me send a quick v2.
@@ -1264,7 +1264,7 @@ show_ring(char *name)
static void
show_mempool(char *name)
{
- uint64_t flags = 0;
+ uint64_t flags;
snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL ");
STATS_BDR_STR(10, bdr_str);