linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ll_temac: Fix return value check in temac_probe()
@ 2020-04-27  9:40 Wei Yongjun
  2020-04-27  9:46 ` Esben Haabendal
  2020-05-01  3:39 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2020-04-27  9:40 UTC (permalink / raw)
  To: michal.simek, esben, andrew, ynezz
  Cc: netdev, kernel-janitors, Wei Yongjun, linux-arm-kernel

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

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/net/ethernet/xilinx/ll_temac_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 3e313e71ae36..929244064abd 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -1410,9 +1410,9 @@ static int temac_probe(struct platform_device *pdev)
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	lp->regs = devm_ioremap(&pdev->dev, res->start,
 					resource_size(res));
-	if (IS_ERR(lp->regs)) {
+	if (!lp->regs) {
 		dev_err(&pdev->dev, "could not map TEMAC registers\n");
-		return PTR_ERR(lp->regs);
+		return -ENOMEM;
 	}
 
 	/* Select register access functions with the specified
@@ -1505,10 +1505,10 @@ static int temac_probe(struct platform_device *pdev)
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 		lp->sdma_regs = devm_ioremap(&pdev->dev, res->start,
 						     resource_size(res));
-		if (IS_ERR(lp->sdma_regs)) {
+		if (!lp->sdma_regs) {
 			dev_err(&pdev->dev,
 				"could not map DMA registers\n");
-			return PTR_ERR(lp->sdma_regs);
+			return -ENOMEM;
 		}
 		if (pdata->dma_little_endian) {
 			lp->dma_in = temac_dma_in32_le;




_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next] net: ll_temac: Fix return value check in temac_probe()
  2020-04-27  9:40 [PATCH net-next] net: ll_temac: Fix return value check in temac_probe() Wei Yongjun
@ 2020-04-27  9:46 ` Esben Haabendal
  2020-05-01  3:39 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Esben Haabendal @ 2020-04-27  9:46 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: andrew, netdev, kernel-janitors, michal.simek, ynezz, linux-arm-kernel

Acked-by: Esben Haabendal <esben@geanix.com>

Wei Yongjun <weiyongjun1@huawei.com> writes:

> In case of error, the function devm_ioremap() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should
> be replaced with NULL test.
>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/net/ethernet/xilinx/ll_temac_main.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
> index 3e313e71ae36..929244064abd 100644
> --- a/drivers/net/ethernet/xilinx/ll_temac_main.c
> +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
> @@ -1410,9 +1410,9 @@ static int temac_probe(struct platform_device *pdev)
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	lp->regs = devm_ioremap(&pdev->dev, res->start,
>  					resource_size(res));
> -	if (IS_ERR(lp->regs)) {
> +	if (!lp->regs) {
>  		dev_err(&pdev->dev, "could not map TEMAC registers\n");
> -		return PTR_ERR(lp->regs);
> +		return -ENOMEM;
>  	}
>  
>  	/* Select register access functions with the specified
> @@ -1505,10 +1505,10 @@ static int temac_probe(struct platform_device *pdev)
>  		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>  		lp->sdma_regs = devm_ioremap(&pdev->dev, res->start,
>  						     resource_size(res));
> -		if (IS_ERR(lp->sdma_regs)) {
> +		if (!lp->sdma_regs) {
>  			dev_err(&pdev->dev,
>  				"could not map DMA registers\n");
> -			return PTR_ERR(lp->sdma_regs);
> +			return -ENOMEM;
>  		}
>  		if (pdata->dma_little_endian) {
>  			lp->dma_in = temac_dma_in32_le;

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next] net: ll_temac: Fix return value check in temac_probe()
  2020-04-27  9:40 [PATCH net-next] net: ll_temac: Fix return value check in temac_probe() Wei Yongjun
  2020-04-27  9:46 ` Esben Haabendal
@ 2020-05-01  3:39 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-05-01  3:39 UTC (permalink / raw)
  To: weiyongjun1
  Cc: andrew, netdev, esben, kernel-janitors, michal.simek, ynezz,
	linux-arm-kernel

From: Wei Yongjun <weiyongjun1@huawei.com>
Date: Mon, 27 Apr 2020 09:40:52 +0000

> In case of error, the function devm_ioremap() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should
> be replaced with NULL test.
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Applied, thank you.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-05-01  3:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27  9:40 [PATCH net-next] net: ll_temac: Fix return value check in temac_probe() Wei Yongjun
2020-04-27  9:46 ` Esben Haabendal
2020-05-01  3:39 ` 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).