power: fix unused-but-set variable error
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
@@ -207,7 +207,7 @@ update_training_stats(struct priority_worker *poll_stats, static __rte_always_inline uint32_tupdate_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
Quoted 5 lines · Jim Harris
clang-13 rightfully complains that the
tot_ppivariable inupdate_statsis set but not used, since the final accumulatedtot_ppiresults isn't used anywhere. So just remove thetot_ppivariable.
Dead code, from the start...
Quoted 28 lines
Signed-off-by Jim Harris <[email protected]>--- lib/power/rte_power_empty_poll.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)lib/power/rte_power_empty_poll.c +1
-3@@ -207,7 +207,7 @@ update_training_stats(struct priority_worker *poll_stats, static __rte_always_inline uint32_tupdate_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
29/10/2021 20:53, David Marchand:
Quoted 20 lines · Jim Harris
Quoted 5 lines
clang-13 rightfully complains that the
tot_ppivariable inupdate_statsis set but not used, since the final accumulatedtot_ppiresults isn't used anywhere. So just remove thetot_ppivariable.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
Reviewed-by David Marchand <[email protected]>
I understand that a v2 removing ppi_av would be better.