Re: [PATCH net-next 1/2] net: stmmac: Return early if invalid in loongson_dwmac_fix_reset()

From: Tiezhu Yang
Date: Tue Jul 22 2025 - 09:10:51 EST


On 2025/7/22 下午8:48, Maxime Chevallier wrote:
On Tue, 22 Jul 2025 14:27:15 +0800
Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> wrote:

If the DMA_BUS_MODE_SFT_RESET bit is 1 before software reset,
there is no need to do anything for this abnormal case, just
return -EINVAL immediately in loongson_dwmac_fix_reset().

Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>

Do you know when that could ever happen ? I'm asking because this logic
for the DMA reset is duplicated in several places in this driver, maybe
this could be useful for other users as well. I'm guessing this is to
avoid waiting for the timeout when the DMA reset fails, but that is
usually when there's a missing clock somewhere (such as the RGMII clock
from the PHY), in which case I don't think the RST bit will be set.

To be honest, I am not quite sure the root cause but this actually
happened on the test environment, I guess there is a missing clock.

You are right, the initial aim of this patch is to return early for
this case to avoid waiting for the timeout when the DMA reset fails.

Thanks,
Tiezhu