power: fix unused-but-set variable error

Message ID 20211029171550.330229-1-james.r.harris@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series power: 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 success Testing PASS
ci/Intel-compilation fail Compilation issues
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-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Harris, James R Oct. 29, 2021, 5:15 p.m. UTC
  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.

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

Comments

David Marchand Oct. 29, 2021, 6:53 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 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")


>
> Signed-off-by: Jim Harris <james.r.harris@intel.com>
> ---
>  lib/power/rte_power_empty_poll.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/lib/power/rte_power_empty_poll.c b/lib/power/rte_power_empty_poll.c
> index 975aa92997..8a2d60c576 100644
> --- a/lib/power/rte_power_empty_poll.c
> +++ b/lib/power/rte_power_empty_poll.c
> @@ -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;
> --
> 2.32.0
>

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

Reviewed-by: David Marchand <david.marchand@redhat.com>
  
Thomas Monjalon Nov. 4, 2021, 5:32 p.m. UTC | #2
29/10/2021 20:53, David Marchand:
> On Fri, Oct 29, 2021 at 7:17 PM Jim Harris <james.r.harris@intel.com> wrote:
> >
> > 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")
> 
> > @@ -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:
> 
> Reviewed-by: David Marchand <david.marchand@redhat.com>

I understand that a v2 removing ppi_av would be better.
  

Patch

diff --git a/lib/power/rte_power_empty_poll.c b/lib/power/rte_power_empty_poll.c
index 975aa92997..8a2d60c576 100644
--- a/lib/power/rte_power_empty_poll.c
+++ b/lib/power/rte_power_empty_poll.c
@@ -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;