public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code
@ 2016-07-06 12:08 weiyj_lk
  2016-07-06 12:18 ` Alexandre Belloni
  2016-07-07  2:08 ` [PATCH -next v2] " weiyj_lk
  0 siblings, 2 replies; 5+ messages in thread
From: weiyj_lk @ 2016-07-06 12:08 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Nicolas Ferre, Paul Gortmaker
  Cc: Wei Yongjun, linux-kernel

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

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

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/memory/atmel-ebi.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
index f87ad6f..b5ed3bd 100644
--- a/drivers/memory/atmel-ebi.c
+++ b/drivers/memory/atmel-ebi.c
@@ -410,10 +410,7 @@ static int at91sam9_ebi_init(struct at91_ebi *ebi)
 
 	field.reg = AT91SAM9_SMC_MODE(AT91SAM9_SMC_GENERIC);
 	fields->mode = devm_regmap_field_alloc(ebi->dev, ebi->smc, field);
-	if (IS_ERR(fields->mode))
-		return PTR_ERR(fields->mode);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(fields->mode);
 }
 
 static int sama5d3_ebi_init(struct at91_ebi *ebi)
@@ -441,10 +438,7 @@ static int sama5d3_ebi_init(struct at91_ebi *ebi)
 
 	field.reg = SAMA5_SMC_MODE(SAMA5_SMC_GENERIC);
 	fields->mode = devm_regmap_field_alloc(ebi->dev, ebi->smc, field);
-	if (IS_ERR(fields->mode))
-		return PTR_ERR(fields->mode);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(fields->mode);
 }
 
 static int at91_ebi_dev_setup(struct at91_ebi *ebi, struct device_node *np,

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

end of thread, other threads:[~2016-07-07  2:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-06 12:08 [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code weiyj_lk
2016-07-06 12:18 ` Alexandre Belloni
2016-07-06 13:19   ` Wei Yongjun
2016-07-06 13:34     ` Alexandre Belloni
2016-07-07  2:08 ` [PATCH -next v2] " weiyj_lk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox