* [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
* Re: [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code
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-07 2:08 ` [PATCH -next v2] " weiyj_lk
1 sibling, 1 reply; 5+ messages in thread
From: Alexandre Belloni @ 2016-07-06 12:18 UTC (permalink / raw)
To: weiyj_lk
Cc: Boris Brezillon, Nicolas Ferre, Paul Gortmaker, Wei Yongjun,
linux-kernel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code
2016-07-06 12:18 ` Alexandre Belloni
@ 2016-07-06 13:19 ` Wei Yongjun
2016-07-06 13:34 ` Alexandre Belloni
0 siblings, 1 reply; 5+ messages in thread
From: Wei Yongjun @ 2016-07-06 13:19 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Boris Brezillon, Nicolas Ferre, Paul Gortmaker, Wei Yongjun,
linux-kernel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code
2016-07-06 13:19 ` Wei Yongjun
@ 2016-07-06 13:34 ` Alexandre Belloni
0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Belloni @ 2016-07-06 13:34 UTC (permalink / raw)
To: Wei Yongjun
Cc: Boris Brezillon, Nicolas Ferre, Paul Gortmaker, Wei Yongjun,
linux-kernel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH -next v2] memory: atmel-ebi: use PTR_ERR_OR_ZERO() to simplify the code
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-07 2:08 ` weiyj_lk
1 sibling, 0 replies; 5+ messages in thread
From: weiyj_lk @ 2016-07-07 2: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.
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,
^ 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