Skip to contentSkip to conversation

net: enetc: Remove error print for devm_add_action_or_reset()

PATCH Superseded Waqar Hameed 2 participants 3 messages Aug 5, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 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
index b3dc1afeefd1..38fb81db48c2 100644
@@ -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: 260f6f4fda93c8485c8037865c941b42b9cba5d2

Signature · 1 line
2.39.5
maintainer
#1 lore raw
Quoted 40 lines

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.kern/
el.org%2Fall%2Fpnd7c0s6ji2.fsf%40axis.com%2F&data=05%7C02%7Cwei.fang% 40nxp.com%7C5c6c1234f2944165bdbe08ddd4032c43%7C686ea1d3bc2b4c6fa9 2cd99c5c301635%7C0%7C0%7C638899832279054100%7CUnknown%7CTWFpb GZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIs IkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=7ejNp6ZnP7B9o gBefpQdq1%2BGCH9vqHogvsU%2FcJZbWzo%3D&reserved=0

 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
index b3dc1afeefd1..38fb81db48c2 100644
@@ -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);
Quoted 3 lines

base-commit: 260f6f4fda93c8485c8037865c941b42b9cba5d2 --
2.39.5

HI Waqar,

The net-next tree is closed until Aug 11th, please resend this patch when it is open. :)

#2 lore raw
Quoted 40 lines · On Tue, Aug 05, 2025 at 09:41 +0000 Wei Fang <[email protected]> wrote:
Quoted 40 lines

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.kern/
el.org%2Fall%2Fpnd7c0s6ji2.fsf%40axis.com%2F&data=05%7C02%7Cwei.fang% 40nxp.com%7C5c6c1234f2944165bdbe08ddd4032c43%7C686ea1d3bc2b4c6fa9 2cd99c5c301635%7C0%7C0%7C638899832279054100%7CUnknown%7CTWFpb GZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIs IkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=7ejNp6ZnP7B9o gBefpQdq1%2BGCH9vqHogvsU%2FcJZbWzo%3D&reserved=0

 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
index b3dc1afeefd1..38fb81db48c2 100644
@@ -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);
Quoted 8 lines
Quoted 3 lines

base-commit: 260f6f4fda93c8485c8037865c941b42b9cba5d2 --
2.39.5

HI Waqar,

The net-next tree is closed until Aug 11th, please resend this patch when it is open. :)

Oh ok, I'll resend it next week then. Thanks for the information!