From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753861AbcGFMSU (ORCPT ); Wed, 6 Jul 2016 08:18:20 -0400 Received: from down.free-electrons.com ([37.187.137.238]:44638 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753054AbcGFMST (ORCPT ); Wed, 6 Jul 2016 08:18:19 -0400 Date: Wed, 6 Jul 2016 14:18:17 +0200 From: Alexandre Belloni To: weiyj_lk@163.com Cc: Boris Brezillon , Nicolas Ferre , Paul Gortmaker , Wei Yongjun , linux-kernel@vger.kernel.org Subject: Re: [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code Message-ID: <20160706121817.GC3623@piout.net> References: <1467806885-25578-1-git-send-email-weiyj_lk@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1467806885-25578-1-git-send-email-weiyj_lk@163.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 06/07/2016 at 12:08:05 +0000, weiyj_lk@163.com wrote : > From: Wei Yongjun > > Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR. > I'm guessing you found that using coccinnelle or any other static analysis tool. Can you mention that in the commit message? > Signed-off-by: Wei Yongjun > --- > 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, > > -- Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com