diff mbox series

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

Message ID Y0bWzJL8JknX8MUf@kili (mailing list archive)
State Accepted
Commit 99df45c9e0a43b1b88dab294265e2be4a040a441
Delegated to: Netdev Maintainers
Headers show
Series [net] sunhme: fix an IS_ERR() vs NULL check in probe | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Dan Carpenter Oct. 12, 2022, 3:01 p.m. UTC
The devm_request_region() function does not return error pointers, it
returns NULL on error.

Fixes: 914d9b2711dd ("sunhme: switch to devres")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/sun/sunhme.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sean Anderson Oct. 12, 2022, 3:52 p.m. UTC | #1
On 10/12/22 11:01, Dan Carpenter wrote:
> The devm_request_region() function does not return error pointers, it
> returns NULL on error.
> 
> Fixes: 914d9b2711dd ("sunhme: switch to devres")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>   drivers/net/ethernet/sun/sunhme.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
> index 62deed210a95..91f10f746dff 100644
> --- a/drivers/net/ethernet/sun/sunhme.c
> +++ b/drivers/net/ethernet/sun/sunhme.c
> @@ -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;
>   	}

Reviewed-by: Sean Anderson <seanga2@gmail.com>
Rolf Eike Beer Oct. 13, 2022, 9:05 a.m. UTC | #2
Am Mittwoch, 12. Oktober 2022, 17:01:32 CEST schrieb Dan Carpenter:
> The devm_request_region() function does not return error pointers, it
> returns NULL on error.
> 
> Fixes: 914d9b2711dd ("sunhme: switch to devres")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Rolf Eike Beer <eike-kernel@sf-tec.de>
patchwork-bot+netdevbpf@kernel.org Oct. 13, 2022, 4:50 p.m. UTC | #3
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  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!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
index 62deed210a95..91f10f746dff 100644
--- a/drivers/net/ethernet/sun/sunhme.c
+++ b/drivers/net/ethernet/sun/sunhme.c
@@ -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;
 	}