net: enetc: Remove error print for devm_add_action_or_reset()
PATCH RESEND v2 1/1 net: enetc: Remove error print for devm_add_action_or_reset()
When devm_add_action_or_reset() fails, it is due to a failed memory allocation and will thus return -ENOMEM. dev_err_probe() doesn't do anything when error is -ENOMEM. Therefore, remove the useless call to dev_err_probe() when devm_add_action_or_reset() fails, and just return the value instead.
---
Changes in v2:
* Split the patch to one seperate patch for each sub-system.
Link to v1: https://lore.kernel.org/all/[email protected]/
drivers/net/ethernet/freescale/enetc/enetc4_pf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc4_pf.c +1 -2
@@ -1016,8 +1016,7 @@ static int enetc4_pf_probe(struct pci_dev *pdev, err =devm_add_action_or_reset (dev, enetc4_pci_remove, pdev);if (err) -return dev_err_probe (dev, err, -"Add enetc4_pci_remove() action failed\n" ); +return err;/* si is the private data. */ si =pci_get_drvdata (pdev);
base-commit: 53e760d8949895390e256e723e7ee46618310361
Signature · 1 line
2.39.5
Quoted 22 lines · Waqar Hameed
When
devm_add_action_or_reset()fails, it is due to a failed memory allocation and will thus return-ENOMEM.dev_err_probe()doesn't do anything when error is-ENOMEM. Therefore, remove the useless call todev_err_probe()whendevm_add_action_or_reset()fails, and just return the value instead.Signed-off-by Waqar Hameed <[email protected]>---
Changes in v2:* Split the patch to one seperate patch for each sub-system.
Link to v1: https://lore.kernel.org/all/[email protected]/
drivers/net/ethernet/freescale/enetc/enetc4_pf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/net/ethernet/freescale/enetc/enetc4_pf.c +0
-0
drivers/net/ethernet/freescale/enetc/enetc4_pf.c static int enetc4_pf_probe(struct pci_dev *pdev, · line 1019
Quoted 6 lines
drivers/net/ethernet/freescale/enetc/enetc4_pf.c +1
-2@@ -1016,8 +1016,7 @@ static int enetc4_pf_probe(struct pci_dev *pdev, err =devm_add_action_or_reset (dev, enetc4_pci_remove, pdev);if (err) -return dev_err_probe (dev, err, -"Add enetc4_pci_remove() action failed\n" ); +return err;
I looked at a couple other drivers that use devm_add_action_or_reset and most follow the pattern proposed by this change.
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Tue, 12 Aug 2025 14:13:58 +0200 you wrote:
When
devm_add_action_or_reset()fails, it is due to a failed memory allocation and will thus return-ENOMEM.dev_err_probe()doesn't do anything when error is-ENOMEM. Therefore, remove the useless call todev_err_probe()whendevm_add_action_or_reset()fails, and just return the value instead.Signed-off-by Waqar Hameed <[email protected]>[...]
Here is the summary with links:
- [RESEND,net-next,v2] net: enetc: Remove error print for devm_add_action_or_reset()
https://git.kernel.org/netdev/net-next/c/3051f49b0e03
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html