git: 38a9b8a00ce9 - main - Fix unused variable warnings in hwpmc_mod.c

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Thu, 21 Jul 2022 19:06:07 UTC
The branch main has been updated by dim:

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

commit 38a9b8a00ce933e99b4a643cdcc3220be82e7d62
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-07-21 18:35:41 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-07-21 19:05:51 +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
---
 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 308b0bdff1bb..e5a12b666e1b 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);