|
@@ -145,7 +145,8 @@ u32 msgdma_tx_completions(struct altera_tse_private *priv)
|
|
|
& 0xffff;
|
|
& 0xffff;
|
|
|
|
|
|
|
|
if (inuse) { /* Tx FIFO is not empty */
|
|
if (inuse) { /* Tx FIFO is not empty */
|
|
|
- ready = priv->tx_prod - priv->tx_cons - inuse - 1;
|
|
|
|
|
|
|
+ ready = max_t(int,
|
|
|
|
|
+ priv->tx_prod - priv->tx_cons - inuse - 1, 0);
|
|
|
} else {
|
|
} else {
|
|
|
/* Check for buffered last packet */
|
|
/* Check for buffered last packet */
|
|
|
status = csrrd32(priv->tx_dma_csr, msgdma_csroffs(status));
|
|
status = csrrd32(priv->tx_dma_csr, msgdma_csroffs(status));
|