Skip to contentSkip to conversation

sunhme: fix an IS_ERR() vs NULL check in probe

PATCH Applied Dan Carpenter 4 participants 4 messages Oct 12, 2022 – Oct 13, 2022

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

PATCH 1/1 sunhme: fix an IS_ERR() vs NULL check in probe

The devm_request_region() function does not return error pointers, it returns NULL on error.

Fixes 914d9b2711dd ("sunhme: switch to devres")
---
 drivers/net/ethernet/sun/sunhme.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/sun/sunhme.c +2 -2
index 62deed210a95..91f10f746dff 100644
@@ -2896,8 +2896,8 @@ static int happy_meal_pci_probe(struct pci_dev *pdev,
 
 	hpreg_res = devm_request_region(&pdev->dev, pci_resource_start(pdev, 0),
 					pci_resource_len(pdev, 0), DRV_NAME);
-	if (IS_ERR(hpreg_res)) {
-		err = PTR_ERR(hpreg_res);
+	if (!hpreg_res) {
+		err = -EBUSY;
 		dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting.\n");
 		goto err_out_clear_quattro;
 	}
Signature · 1 line
2.35.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Dan Carpenter

The devm_request_region() function does not return error pointers, it returns NULL on error.

Fixes 914d9b2711dd ("sunhme: switch to devres")
---
  drivers/net/ethernet/sun/sunhme.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/sun/sunhme.c +0 -0
index 62deed210a95..91f10f746dff 100644

drivers/net/ethernet/sun/sunhme.c static int happy_meal_pci_probe(struct pci_dev *pdev, · line 2903

Quoted 10 lines
drivers/net/ethernet/sun/sunhme.c +2 -2
@@ -2896,8 +2896,8 @@ static int happy_meal_pci_probe(struct pci_dev *pdev,
 
  	hpreg_res = devm_request_region(&pdev->dev, pci_resource_start(pdev, 0),
  					pci_resource_len(pdev, 0), DRV_NAME);
-	if (IS_ERR(hpreg_res)) {
-		err = PTR_ERR(hpreg_res);
+	if (!hpreg_res) {
+		err = -EBUSY;
  		dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting.\n");
  		goto err_out_clear_quattro;
  	}
#3 lore raw
In reply to Dan Carpenter
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 12 Oct 2022 18:01:32 +0300 you wrote:

The devm_request_region() function does not return error pointers, it returns NULL on error.

Fixes 914d9b2711dd ("sunhme: switch to devres")
---
 drivers/net/ethernet/sun/sunhme.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Here is the summary with links:
- [net] sunhme: fix an IS_ERR() vs NULL check in probe

    https://git.kernel.org/netdev/net/c/99df45c9e0a4

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html