net: ll_temac: Fix return value check in temac_probe()
Subsystems (5)
PATCH 1/1 net: ll_temac: Fix return value check in temac_probe()
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 <[email protected]>
--- drivers/net/ethernet/xilinx/ll_temac_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/xilinx/ll_temac_main.c +4 -4
@@ -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;
Acked-by Esben Haabendal <[email protected]>
Quoted 38 lines · Wei Yongjun
In case of error, the function
devm_ioremap()returns NULL pointer notERR_PTR(). TheIS_ERR()test in the return value check should be replaced with NULL test.Signed-off-by Wei Yongjun <[email protected]>--- drivers/net/ethernet/xilinx/ll_temac_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/net/ethernet/xilinx/ll_temac_main.c +4
-4@@ -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;
From: Wei Yongjun <[email protected]>
Date: Mon, 27 Apr 2020 09:40:52 +0000
Quoted 5 lines
In case of error, the function
devm_ioremap()returns NULL pointer notERR_PTR(). TheIS_ERR()test in the return value check should be replaced with NULL test.Signed-off-by Wei Yongjun <[email protected]>
Applied, thank you.