]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: stmmac: Check stmmac_hw_setup() in stmmac_resume()
authorTiezhu Yang <yangtiezhu@loongson.cn>
Mon, 11 Aug 2025 07:35:04 +0000 (15:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:37:00 +0000 (15:37 -0500)
[ Upstream commit 6896c2449a1858acb643014894d01b3a1223d4e5 ]

stmmac_hw_setup() may return 0 on success and an appropriate negative
integer as defined in errno.h file on failure, just check it and then
return early if failed in stmmac_resume().

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Link: https://patch.msgid.link/20250811073506.27513-2-yangtiezhu@loongson.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 7b16d1207b80c9950e1f017ba038a5c527c78ea5..b9f55e4e360fb9ff665789c98eda3a257d89c054 100644 (file)
@@ -7977,7 +7977,14 @@ int stmmac_resume(struct device *dev)
        stmmac_free_tx_skbufs(priv);
        stmmac_clear_descriptors(priv, &priv->dma_conf);
 
-       stmmac_hw_setup(ndev, false);
+       ret = stmmac_hw_setup(ndev, false);
+       if (ret < 0) {
+               netdev_err(priv->dev, "%s: Hw setup failed\n", __func__);
+               mutex_unlock(&priv->lock);
+               rtnl_unlock();
+               return ret;
+       }
+
        stmmac_init_coalesce(priv);
        phylink_rx_clk_stop_block(priv->phylink);
        stmmac_set_rx_mode(ndev);