spi: bcm63xx-hsspi: checking for ERR_PTR instead of NULL
PATCH 1/1 spi: bcm63xx-hsspi: checking for ERR_PTR instead of NULL
devm_request_and_ioremap() returns NULL on error, it doesn't return an ERR_PTR().
drivers/spi/spi-bcm63xx-hsspi.c +2 -2
@@ -339,8 +339,8 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev) res_mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); regs =devm_request_and_ioremap (dev, res_mem); -if (IS_ERR (regs)) -return PTR_ERR (regs); +if (!regs) +return -EADDRNOTAVAIL ; clk =clk_get (dev,"hsspi" );
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Dan Carpenter
devm_request_and_ioremap()returns NULL on error, it doesn't return anERR_PTR().Fixes 142168eba9dc ('spi: bcm63xx-hsspi: add bcm63xx HSSPI driver')Signed-off-by Dan Carpenter <[email protected]>drivers/spi/spi-bcm63xx-hsspi.c +0
-0
drivers/spi/spi-bcm63xx-hsspi.c static int bcm63xx_hsspi_probe(struct platform_device *pdev) · line 343
Quoted 7 lines
drivers/spi/spi-bcm63xx-hsspi.c +2
-2@@ -339,8 +339,8 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev) res_mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); regs =devm_request_and_ioremap (dev, res_mem); -if (IS_ERR (regs)) -return PTR_ERR (regs); +if (!regs) +return -EADDRNOTAVAIL ;
Instead of fixing the wrong handling of the return value, let's change it to use devm_ioremap_resource() which actually returns the expected ERR_PTR() and is preferred over request_and_ioremap().
Regards
Jonas
Quoted 13 lines · Jonas Gorski
Quoted 12 lines · Dan Carpenter
devm_request_and_ioremap()returns NULL on error, it doesn't return anERR_PTR().Fixes 142168eba9dc ('spi: bcm63xx-hsspi: add bcm63xx HSSPI driver')Signed-off-by Dan Carpenter <[email protected]>drivers/spi/spi-bcm63xx-hsspi.c +0
-0@@ -339,8 +339,8 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
Quoted 11 lines
drivers/spi/spi-bcm63xx-hsspi.c static int bcm63xx_hsspi_probe(struct platform_device *pdev) · line 343
Quoted 6 lines
drivers/spi/spi-bcm63xx-hsspi.c +2
-2res_mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); regs =devm_request_and_ioremap (dev, res_mem); -if (IS_ERR (regs)) -return PTR_ERR (regs); +if (!regs) +return -EADDRNOTAVAIL ;Instead of fixing the wrong handling of the return value, let's change it to use
devm_ioremap_resource()which actually returns the expectedERR_PTR()and is preferred overrequest_and_ioremap().
Sure. I'll resend a v2.
regards,
dan carpenter
A message that is not in the archive (sent off-list or not yet received): CAOiHx=k87c_bFqFtJ7zJc9HxnjOEr2oMofNUsLkQbfQPrC04hQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
PATCH v2 1/1 spi: bcm63xx-hsspi: checking for ERR_PTR instead of NULL
devm_request_and_ioremap() returns NULL on error, it doesn't return an ERR_PTR(). This patch fixes it by switching to devm_ioremap_resource() which is the prefered function anyway.
---
v2: switch to devm_ioremap_resource()
drivers/spi/spi-bcm63xx-hsspi.c +1 -1
@@ -338,7 +338,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev) } res_mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - regs =devm_request_and_ioremap (dev, res_mem); + regs =devm_ioremap_resource (dev, res_mem);if (IS_ERR (regs))return PTR_ERR (regs);
A message that is not in the archive (sent off-list or not yet received): [email protected]
Jonas Gorski
Acked-byQuoted 6 lines · Dan Carpenter
devm_request_and_ioremap()returns NULL on error, it doesn't return anERR_PTR(). This patch fixes it by switching todevm_ioremap_resource()which is the prefered function anyway.Fixes 142168eba9dc ('spi: bcm63xx-hsspi: add bcm63xx HSSPI driver')Signed-off-by Dan Carpenter <[email protected]>
Thanks.
Jonas
Quoted 20 lines
---
v2: switch todevm_ioremap_resource()drivers/spi/spi-bcm63xx-hsspi.c +1
-2@@ -338,7 +338,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev) } res_mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - regs =devm_request_and_ioremap (dev, res_mem); + regs =devm_ioremap_resource (dev, res_mem);if (IS_ERR (regs))return PTR_ERR (regs); --To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Dan Carpenter
devm_request_and_ioremap()returns NULL on error, it doesn't return anERR_PTR(). This patch fixes it by switching todevm_ioremap_resource()which is the prefered function anyway.
Applied, thanks.