]> 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:34:11 +0000 (15:34 -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 40d56ff66b6a82c91cb9ce6d7d311fbb6969acb4..16f76a89cb0d0330c942c3ac09aa9ada2e7c41d9 100644 (file)
@@ -8030,7 +8030,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);
        stmmac_set_rx_mode(ndev);