[PATCH] net: stmmac: Allow zero for [tr]x_fifo_size
From: Steven Price
Date: Mon Feb 03 2025 - 04:34:47 EST
Commit 8865d22656b4 ("net: stmmac: Specify hardware capability value
when FIFO size isn't specified") modified the behaviour to bail out if
both the FIFO size and the hardware capability were both set to zero.
However devices where has_gmac4 and has_xgmac are both false don't use
the fifo size and that commit breaks platforms for which these values
were zero.
Only warn and error out when (has_gmac4 || has_xgmac) where the values
are used and zero would cause problems, otherwise continue with the zero
values.
Fixes: 8865d22656b4 ("net: stmmac: Specify hardware capability value when FIFO size isn't specified")
Tested-by: Xi Ruoyao <xry111@xxxxxxxxxxx>
Signed-off-by: Steven Price <steven.price@xxxxxxx>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index d04543e5697b..821404beb629 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7222,7 +7222,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
if (!priv->plat->rx_fifo_size) {
if (priv->dma_cap.rx_fifo_size) {
priv->plat->rx_fifo_size = priv->dma_cap.rx_fifo_size;
- } else {
+ } else if (priv->plat->has_gmac4 || priv->plat->has_xgmac) {
dev_err(priv->device, "Can't specify Rx FIFO size\n");
return -ENODEV;
}
@@ -7236,7 +7236,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
if (!priv->plat->tx_fifo_size) {
if (priv->dma_cap.tx_fifo_size) {
priv->plat->tx_fifo_size = priv->dma_cap.tx_fifo_size;
- } else {
+ } else if (priv->plat->has_gmac4 || priv->plat->has_xgmac) {
dev_err(priv->device, "Can't specify Tx FIFO size\n");
return -ENODEV;
}
--
2.43.0