]> 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)
committerJakub Kicinski <kuba@kernel.org>
Wed, 13 Aug 2025 23:27:42 +0000 (16:27 -0700)
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>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 4a82045ea6ebfef0a13f5bc9c217bc39b05dedee..9a77390b7f9da4199ad6ac15a2149e2c703900ce 100644 (file)
@@ -7984,7 +7984,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);