git: e2fae920c5bd - stable/13 - Fix unused variable warnings in hwpmc_mod.c

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sun, 24 Jul 2022 11:01:43 UTC
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=e2fae920c5bdf6bf59f7ac2da8efd16c12b13987

commit e2fae920c5bdf6bf59f7ac2da8efd16c12b13987
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-07-21 18:35:41 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-07-24 11:00:07 +0000

    Fix unused variable warnings in hwpmc_mod.c
    
    With clang 15, the following -Werror warnings are produced:
    
        sys/dev/hwpmc/hwpmc_mod.c:4805:6: error: variable 'nfree' set but not used [-Werror,-Wunused-but-set-variable]
                int nfree;
                    ^
        sys/dev/hwpmc/hwpmc_mod.c:4804:6: error: variable 'ncallchains' set but not used [-Werror,-Wunused-but-set-variable]
                int ncallchains;
                    ^
    
    The 'nfree' and 'ncallchains' variables were used in KASSERTs, but these
    were removed due to refactoring in d9f1b8dbf29d. Remove the variables
    since they no longer serve any purpose.
    
    MFC after:      3 days
    
    (cherry picked from commit 38a9b8a00ce933e99b4a643cdcc3220be82e7d62)
---
 sys/dev/hwpmc/hwpmc_mod.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c
index 50b4f3bc9d3b..47d0add3a383 100644
--- a/sys/dev/hwpmc/hwpmc_mod.c
+++ b/sys/dev/hwpmc/hwpmc_mod.c
@@ -4801,8 +4801,6 @@ pmc_capture_user_callchain(int cpu, int ring, struct trapframe *tf)
 	uint64_t considx, prodidx;
 	int nsamples, nrecords, pass, iter;
 #ifdef	INVARIANTS
-	int ncallchains;
-	int nfree;
 	int start_ticks = ticks;
 #endif
 	psb = pmc_pcpu[cpu]->pc_sb[ring];
@@ -4812,10 +4810,6 @@ pmc_capture_user_callchain(int cpu, int ring, struct trapframe *tf)
 	    ("[pmc,%d] Retrieving callchain for thread that doesn't want it",
 		__LINE__));
 
-#ifdef	INVARIANTS
-	ncallchains = 0;
-	nfree = 0;
-#endif
 	nrecords = INT_MAX;
 	pass = 0;
  restart:
@@ -4834,13 +4828,8 @@ pmc_capture_user_callchain(int cpu, int ring, struct trapframe *tf)
 
 #ifdef	INVARIANTS
 		if (ps->ps_nsamples == PMC_SAMPLE_FREE) {
-			nfree++;
 			continue;
 		}
-
-		if ((ps->ps_pmc == NULL) ||
-		    (ps->ps_pmc->pm_state != PMC_STATE_RUNNING))
-			nfree++;
 #endif
 		if (ps->ps_td != td ||
 		   ps->ps_nsamples != PMC_USER_CALLCHAIN_PENDING ||
@@ -4871,10 +4860,6 @@ pmc_capture_user_callchain(int cpu, int ring, struct trapframe *tf)
 		 * as 'processable' by the timer tick sweep code.
 		 */
 
-#ifdef INVARIANTS
-		ncallchains++;
-#endif
-
 		if (__predict_true(nsamples < pmc_callchaindepth - 1))
 			nsamples += pmc_save_user_callchain(ps->ps_pc + nsamples,
 		       pmc_callchaindepth - nsamples - 1, tf);