Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1437666 > unrolled thread

[PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code

Started byweiyj_lk@163.com
First post2016-07-06 14:10 +0200
Last post2016-07-07 04:10 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code weiyj_lk@163.com - 2016-07-06 14:10 +0200
    Re: [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to  simplify the code Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-07-06 14:20 +0200
      Re: [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to  simplify the code Wei Yongjun <weiyj_lk@163.com> - 2016-07-06 15:30 +0200
        Re: [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to  simplify the code Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-07-06 15:40 +0200
    [PATCH -next v2] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code weiyj_lk@163.com - 2016-07-07 04:10 +0200

#1437666 — [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code

Fromweiyj_lk@163.com
Date2016-07-06 14:10 +0200
Subject[PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code
Message-ID<rRTOq-Bq-15@gated-at.bofh.it>
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,

[toc] | [next] | [standalone]


#1437670 — Re: [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code

FromAlexandre Belloni <alexandre.belloni@free-electrons.com>
Date2016-07-06 14:20 +0200
SubjectRe: [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code
Message-ID<rRTY5-EK-5@gated-at.bofh.it>
In reply to#1437666
Hi,

On 06/07/2016 at 12:08:05 +0000, weiyj_lk@163.com wrote :
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> 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 <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,
> 
> 

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

[toc] | [prev] | [next] | [standalone]


#1437713 — Re: [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code

FromWei Yongjun <weiyj_lk@163.com>
Date2016-07-06 15:30 +0200
SubjectRe: [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code
Message-ID<rRV3P-1jb-11@gated-at.bofh.it>
In reply to#1437670
Hi,

On 07/06/2016 08:18 PM, Alexandre Belloni wrote:
> Hi,
>
> On 06/07/2016 at 12:08:05 +0000, weiyj_lk@163.com wrote :
>> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>>
>> 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?
>
Your are right, this patch is found by coccinelle and created by scripts.
(I called it dpatch, a kernel patch IDE, which had integrated coccinelle,
sparse engine, scripts to found and create kernel patch.
REF: https://github.com/weiyj/dpatch-devel).

I mentioned those in passed, but no all of people like this.

Regards,
Wei Yongjun 

[toc] | [prev] | [next] | [standalone]


#1437726 — Re: [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code

FromAlexandre Belloni <alexandre.belloni@free-electrons.com>
Date2016-07-06 15:40 +0200
SubjectRe: [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code
Message-ID<rRVdv-1mu-17@gated-at.bofh.it>
In reply to#1437713
On 06/07/2016 at 21:19:34 +0800, Wei Yongjun wrote :
> Hi,
> 
> On 07/06/2016 08:18 PM, Alexandre Belloni wrote:
> > Hi,
> >
> > On 06/07/2016 at 12:08:05 +0000, weiyj_lk@163.com wrote :
> >> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> >>
> >> 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?
> >
> Your are right, this patch is found by coccinelle and created by scripts.
> (I called it dpatch, a kernel patch IDE, which had integrated coccinelle,
> sparse engine, scripts to found and create kernel patch.
> REF: https://github.com/weiyj/dpatch-devel).
> 
> I mentioned those in passed, but no all of people like this.
> 

Well it helps knowing whether this has been tested on actual hardware or
not.

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

[toc] | [prev] | [next] | [standalone]


#1438126 — [PATCH -next v2] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code

Fromweiyj_lk@163.com
Date2016-07-07 04:10 +0200
Subject[PATCH -next v2] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code
Message-ID<rS6Vj-wl-1@gated-at.bofh.it>
In reply to#1437666
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

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

Generated by coccinelle.

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,

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web