The branch stable/12 has been updated by dim:

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

commit 91a308757bdce7dc680feb43debad46a22d539a5
Author:     Dimitry Andric <[email protected]>
AuthorDate: 2022-07-26 19:53:08 +0000
Commit:     Dimitry Andric <[email protected]>
CommitDate: 2022-07-29 18:44:10 +0000

    Fix unused variable warning in amd64's pmap.c
    
    With clang 15, the following -Werror warning is produced:
    
        sys/amd64/amd64/pmap.c:8274:22: error: variable 'freed' set but not 
used [-Werror,-Wunused-but-set-variable]
                int allfree, field, freed, i, 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
    
    (cherry picked from commit 7a1f289bd2949e5867c7f0396c35f02f179dc8bd)
---
 sys/amd64/amd64/pmap.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 945779bce9a0..b2fe589ed029 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -6975,7 +6975,10 @@ pmap_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;
 
@@ -7008,7 +7011,9 @@ pmap_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) {
@@ -7123,7 +7128,9 @@ pmap_remove_pages(pmap_t pmap)
                                        }
                                }
                                pmap_unuse_pt(pmap, pv->pv_va, ptepde, &free);
+#ifdef PV_STATS
                                freed++;
+#endif
                        }
                }
                PV_STAT(atomic_add_long(&pv_entry_frees, freed));

Reply via email to