Skip to contentSkip to conversation

power: fix unused-but-set variable error

PATCH In review Jim Harris 3 participants 3 messages Oct 29, 2021 – Nov 4, 2021

lore
Share & tools
lore

Jim Harris

author
#0 lore raw

PATCH 1/1 power: fix unused-but-set variable error

clang-13 rightfully complains that the tot_ppi variable in update_stats is set but not used, since the final accumulated tot_ppi results isn't used anywhere. So just remove the tot_ppi variable.

---
 lib/power/rte_power_empty_poll.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/power/rte_power_empty_poll.c +1 -2
index 975aa92997..8a2d60c576 100644
@@ -207,7 +207,7 @@ update_training_stats(struct priority_worker *poll_stats,
 static __rte_always_inline uint32_t
 update_stats(struct priority_worker *poll_stats)
 {
-	uint64_t tot_edpi = 0, tot_ppi = 0;
+	uint64_t tot_edpi = 0;
 	uint32_t j, percent;
 
 	struct priority_worker *s = poll_stats;
@@ -237,7 +237,6 @@ update_stats(struct priority_worker *poll_stats)
 
 	for (j = 0; j < BINS_AV; j++) {
 		tot_edpi += s->edpi_av[j];
-		tot_ppi += s->ppi_av[j];
 	}
 
 	tot_edpi = tot_edpi / BINS_AV;
Signature · 1 line
2.32.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jim Harris

clang-13 rightfully complains that the tot_ppi variable in update_stats is set but not used, since the final accumulated tot_ppi results isn't used anywhere. So just remove the tot_ppi variable.

Dead code, from the start...

Fixes 450f0791312c ("power: add traffic pattern aware power control")
Quoted 28 lines
---
 lib/power/rte_power_empty_poll.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/power/rte_power_empty_poll.c +1 -3
index 975aa92997..8a2d60c576 100644
@@ -207,7 +207,7 @@ update_training_stats(struct priority_worker *poll_stats,
 static __rte_always_inline uint32_t
 update_stats(struct priority_worker *poll_stats)
 {
-       uint64_t tot_edpi = 0, tot_ppi = 0;
+       uint64_t tot_edpi = 0;
        uint32_t j, percent;
 
        struct priority_worker *s = poll_stats;
@@ -237,7 +237,6 @@ update_stats(struct priority_worker *poll_stats)
 
        for (j = 0; j < BINS_AV; j++) {
                tot_edpi += s->edpi_av[j];
-               tot_ppi += s->ppi_av[j];
        }
 
        tot_edpi = tot_edpi / BINS_AV;
--
Quoted 2 lines

2.32.0

I don't think keeping ppi_av[] (and related data struct) is that useful.. but in any case patch lgtm:

Signature · 1 line
David Marchand
#2 lore raw

29/10/2021 20:53, David Marchand:

Quoted 20 lines · Jim Harris
Quoted 5 lines

clang-13 rightfully complains that the tot_ppi variable in update_stats is set but not used, since the final accumulated tot_ppi results isn't used anywhere. So just remove the tot_ppi variable.

Dead code, from the start...

Fixes 450f0791312c ("power: add traffic pattern aware power control")

lib/power/rte_power_empty_poll.c update_stats(struct priority_worker *poll_stats) · line 240

Quoted 6 lines
lib/power/rte_power_empty_poll.c +0 -1
@@ -237,7 +237,6 @@ update_stats(struct priority_worker *poll_stats)
 
        for (j = 0; j < BINS_AV; j++) {
                tot_edpi += s->edpi_av[j];
-               tot_ppi += s->ppi_av[j];
        }

I don't think keeping ppi_av[] (and related data struct) is that useful.. but in any case patch lgtm:

Quoted 1 line

I understand that a v2 removing ppi_av would be better.