git: 94b81ba2a0f9 - stable/12 - Fix unused variable warning in fwohci.c
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 24 Jul 2022 11:02:33 UTC
The branch stable/12 has been updated by dim:
URL: https://cgit.FreeBSD.org/src/commit/?id=94b81ba2a0f97019bd85fed273d69076396f1d11
commit 94b81ba2a0f97019bd85fed273d69076396f1d11
Author: Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-07-21 17:59:08 +0000
Commit: Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-07-24 11:01:22 +0000
Fix unused variable warning in fwohci.c
With clang 15, the following -Werror warning is produced:
sys/dev/firewire/fwohci.c:2762:23: error: variable 'pcnt' set but not used [-Werror,-Wunused-but-set-variable]
int len, plen, hlen, pcnt, offset;
^
The 'pcnt' variable is eventually used only in an #if 0'd block,
obviously meant for debugging. Ensure that 'pcnt' is only declared and
used when COUNT_PACKETS is defined, so the debugging can be easily
turned on later, if desired.
MFC after: 3 days
(cherry picked from commit d7e0d962f39877b997454992a980f4122c6316e7)
---
sys/dev/firewire/fwohci.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c
index e54d0c4f53bd..93f682ee145b 100644
--- a/sys/dev/firewire/fwohci.c
+++ b/sys/dev/firewire/fwohci.c
@@ -2740,7 +2740,10 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count)
uint8_t *ld;
uint32_t stat, off, status, event;
u_int spd;
- int len, plen, hlen, pcnt, offset;
+#ifdef COUNT_PACKETS
+ int pcnt;
+#endif
+ int len, plen, hlen, offset;
int s;
caddr_t buf;
int resCount;
@@ -2755,7 +2758,9 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count)
s = splfw();
db_tr = dbch->top;
+#ifdef COUNT_PACKETS
pcnt = 0;
+#endif
/* XXX we cannot handle a packet which lies in more than two buf */
fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_POSTREAD);
fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_POSTWRITE);
@@ -2921,7 +2926,9 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count)
#endif
break;
}
+#ifdef COUNT_PACKETS
pcnt++;
+#endif
if (dbch->pdb_tr != NULL) {
fwohci_arcv_free_buf(sc, dbch, dbch->pdb_tr,
off, 1);
@@ -2951,7 +2958,7 @@ out:
}
/* XXX make sure DMA is not dead */
}
-#if 0
+#ifdef COUNT_PACKETS
if (pcnt < 1)
printf("fwohci_arcv: no packets\n");
#endif