diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2022-07-21 17:59:08 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2022-07-21 19:05:50 +0000 |
commit | d7e0d962f39877b997454992a980f4122c6316e7 (patch) | |
tree | 416a3696e2990c5bfaadec36f40573531c6c95a7 | |
parent | abfa92dee642a3687aaef107203e69722a16ef8c (diff) | |
download | src-d7e0d962f39877b997454992a980f4122c6316e7.tar.gz src-d7e0d962f39877b997454992a980f4122c6316e7.zip |
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
-rw-r--r-- | sys/dev/firewire/fwohci.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 9c95bff21ccb..9c182c6fa331 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -2759,7 +2759,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; @@ -2774,7 +2777,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); @@ -2940,7 +2945,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); @@ -2970,7 +2977,7 @@ out: } /* XXX make sure DMA is not dead */ } -#if 0 +#ifdef COUNT_PACKETS if (pcnt < 1) printf("fwohci_arcv: no packets\n"); #endif |