Skip to contentSkip to conversation

pcmcia: at91_cf: Use PTR_ERR_OR_ZERO()

PATCH Applied Vasyl Gomonovych 3 participants 3 messages Nov 28, 2017 – Nov 29, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pcmcia: at91_cf: Use PTR_ERR_OR_ZERO()

Fix ptr_ret.cocci warnings:
drivers/pcmcia/at91_cf.c:239:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

---
 drivers/pcmcia/at91_cf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pcmcia/at91_cf.c +1 -3
index 87147bcd1655..7da7b0f0ae1b 100644
@@ -236,10 +236,8 @@ static int at91_cf_dt_init(struct platform_device *pdev)
 	pdev->dev.platform_data = board;
 
 	mc = syscon_regmap_lookup_by_compatible("atmel,at91rm9200-sdramc");
-	if (IS_ERR(mc))
-		return PTR_ERR(mc);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(mc);
 }
 #else
 static int at91_cf_dt_init(struct platform_device *pdev)
Signature · 1 line
1.9.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Vasyl Gomonovych

Fix ptr_ret.cocci warnings:
drivers/pcmcia/at91_cf.c:239:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

okay...

Quoted 21 lines
---
 drivers/pcmcia/at91_cf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pcmcia/at91_cf.c +1 -3
index 87147bcd1655..7da7b0f0ae1b 100644
@@ -236,10 +236,8 @@ static int at91_cf_dt_init(struct platform_device *pdev)
 	pdev->dev.platform_data = board;
 
 	mc = syscon_regmap_lookup_by_compatible("atmel,at91rm9200-sdramc");
-	if (IS_ERR(mc))
-		return PTR_ERR(mc);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(mc);
 }
 #else
 static int at91_cf_dt_init(struct platform_device *pdev)
Signature · 1 line
Nicolas Ferre
#2 lore raw
In reply to Vasyl Gomonovych
Quoted 12 lines · Vasyl Gomonovych

Fix ptr_ret.cocci warnings:
drivers/pcmcia/at91_cf.c:239:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

---
 drivers/pcmcia/at91_cf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com