mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
Fix a bug in the TX command handling - log when a too-large payload is
sent, and fix a bug I found when doing so.
This commit is contained in:
parent
20aff35e6b
commit
436ed6b50d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=288255
@ -1292,6 +1292,14 @@ otus_cmd(struct otus_softc *sc, uint8_t code, const void *idata, int ilen,
|
||||
|
||||
/* Always bulk-out a multiple of 4 bytes. */
|
||||
xferlen = (sizeof (*hdr) + ilen + 3) & ~3;
|
||||
if (xferlen > OTUS_MAX_TXCMDSZ) {
|
||||
device_printf(sc->sc_dev, "%s: command (0x%02x) size (%d) > %d\n",
|
||||
__func__,
|
||||
code,
|
||||
xferlen,
|
||||
OTUS_MAX_TXCMDSZ);
|
||||
return (EIO);
|
||||
}
|
||||
|
||||
cmd = otus_get_txcmd(sc);
|
||||
if (cmd == NULL) {
|
||||
@ -1346,7 +1354,7 @@ otus_write(struct otus_softc *sc, uint32_t reg, uint32_t val)
|
||||
sc->write_buf[sc->write_idx].reg = htole32(reg);
|
||||
sc->write_buf[sc->write_idx].val = htole32(val);
|
||||
|
||||
if (++sc->write_idx > AR_MAX_WRITE_IDX)
|
||||
if (++sc->write_idx > (AR_MAX_WRITE_IDX-1))
|
||||
(void)otus_write_barrier(sc);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user