netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: lantiq: Fix return value check in xrx200_probe()
@ 2018-09-15  1:33 Wei Yongjun
  2018-09-15  9:15 ` Hauke Mehrtens
  2018-09-17 15:07 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2018-09-15  1:33 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: Wei Yongjun, netdev, kernel-janitors

In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Fixes: fe1a56420cf2 ("net: lantiq: Add Lantiq / Intel VRX200 Ethernet driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/net/ethernet/lantiq_xrx200.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
index c8b6d90..4a16076 100644
--- a/drivers/net/ethernet/lantiq_xrx200.c
+++ b/drivers/net/ethernet/lantiq_xrx200.c
@@ -461,9 +461,9 @@ static int xrx200_probe(struct platform_device *pdev)
 	}
 
 	priv->pmac_reg = devm_ioremap_resource(dev, res);
-	if (!priv->pmac_reg) {
+	if (IS_ERR(priv->pmac_reg)) {
 		dev_err(dev, "failed to request and remap io ranges\n");
-		return -ENOMEM;
+		return PTR_ERR(priv->pmac_reg);
 	}
 
 	priv->chan_rx.dma.irq = platform_get_irq_byname(pdev, "rx");

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: lantiq: Fix return value check in xrx200_probe()
  2018-09-15  1:33 [PATCH net-next] net: lantiq: Fix return value check in xrx200_probe() Wei Yongjun
@ 2018-09-15  9:15 ` Hauke Mehrtens
  2018-09-17 15:07 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Hauke Mehrtens @ 2018-09-15  9:15 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: netdev, kernel-janitors


[-- Attachment #1.1: Type: text/plain, Size: 1160 bytes --]

On 09/15/2018 03:33 AM, Wei Yongjun wrote:
> In case of error, the function devm_ioremap_resource() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check should
> be replaced with IS_ERR().
> 
> Fixes: fe1a56420cf2 ("net: lantiq: Add Lantiq / Intel VRX200 Ethernet driver")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Acked-by: Hauke Mehrtens <hauke@hauke-m.de>

> ---
>  drivers/net/ethernet/lantiq_xrx200.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
> index c8b6d90..4a16076 100644
> --- a/drivers/net/ethernet/lantiq_xrx200.c
> +++ b/drivers/net/ethernet/lantiq_xrx200.c
> @@ -461,9 +461,9 @@ static int xrx200_probe(struct platform_device *pdev)
>  	}
>  
>  	priv->pmac_reg = devm_ioremap_resource(dev, res);
> -	if (!priv->pmac_reg) {
> +	if (IS_ERR(priv->pmac_reg)) {
>  		dev_err(dev, "failed to request and remap io ranges\n");
> -		return -ENOMEM;
> +		return PTR_ERR(priv->pmac_reg);
>  	}
>  
>  	priv->chan_rx.dma.irq = platform_get_irq_byname(pdev, "rx");
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: lantiq: Fix return value check in xrx200_probe()
  2018-09-15  1:33 [PATCH net-next] net: lantiq: Fix return value check in xrx200_probe() Wei Yongjun
  2018-09-15  9:15 ` Hauke Mehrtens
@ 2018-09-17 15:07 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-09-17 15:07 UTC (permalink / raw)
  To: weiyongjun1; +Cc: hauke, netdev, kernel-janitors

From: Wei Yongjun <weiyongjun1@huawei.com>
Date: Sat, 15 Sep 2018 01:33:50 +0000

> In case of error, the function devm_ioremap_resource() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check should
> be replaced with IS_ERR().
> 
> Fixes: fe1a56420cf2 ("net: lantiq: Add Lantiq / Intel VRX200 Ethernet driver")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-17 20:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-15  1:33 [PATCH net-next] net: lantiq: Fix return value check in xrx200_probe() Wei Yongjun
2018-09-15  9:15 ` Hauke Mehrtens
2018-09-17 15:07 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).