git: 3446738e8deb - main - Fix unused variable warning in mmu_radix.c

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Mon, 15 Aug 2022 18:49:25 UTC
The branch main has been updated by dim:

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

commit 3446738e8deb6d475f88ca16fbb7b11473d17010
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-08-15 18:42:51 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-08-15 18:48:34 +0000

    Fix unused variable warning in mmu_radix.c
    
    With clang 15, the following -Werror warning is produced:
    
        sys/powerpc/aim/mmu_radix.c:5409:22: error: variable 'freed' set but not used [-Werror,-Wunused-but-set-variable]
                int allfree, field, freed, idx;
                                    ^
    
    The 'freed' variable is only used when PV_STATS is defined. Ensure it is
    only declared and set in that case.
    
    MFC after:      3 days
---
 sys/powerpc/aim/mmu_radix.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c
index dc7bdaaa6ed9..955618d57e68 100644
--- a/sys/powerpc/aim/mmu_radix.c
+++ b/sys/powerpc/aim/mmu_radix.c
@@ -5406,7 +5406,10 @@ mmu_radix_remove_pages(pmap_t pmap)
 	struct rwlock *lock;
 	int64_t bit;
 	uint64_t inuse, bitmask;
-	int allfree, field, freed, idx;
+	int allfree, field, idx;
+#ifdef PV_STATS
+	int freed;
+#endif
 	boolean_t superpage;
 	vm_paddr_t pa;
 
@@ -5425,7 +5428,9 @@ mmu_radix_remove_pages(pmap_t pmap)
 	PMAP_LOCK(pmap);
 	TAILQ_FOREACH_SAFE(pc, &pmap->pm_pvchunk, pc_list, npc) {
 		allfree = 1;
+#ifdef PV_STATS
 		freed = 0;
+#endif
 		for (field = 0; field < _NPCM; field++) {
 			inuse = ~pc->pc_map[field] & pc_freemask[field];
 			while (inuse != 0) {
@@ -5542,7 +5547,9 @@ mmu_radix_remove_pages(pmap_t pmap)
 					}
 				}
 				pmap_unuse_pt(pmap, pv->pv_va, ptel3e, &free);
+#ifdef PV_STATS
 				freed++;
+#endif
 			}
 		}
 		PV_STAT(atomic_add_long(&pv_entry_frees, freed));