All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: Use PTR_ERR_OR_ZERO
@ 2017-08-29 13:46 ` Himanshu Jha
  0 siblings, 0 replies; 6+ messages in thread
From: Himanshu Jha @ 2017-08-29 13:46 UTC (permalink / raw)
  To: a.zummo
  Cc: alexandre.belloni, baruch, linux-rtc, linux-arm-kernel,
	linux-kernel, Himanshu Jha

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

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
 drivers/rtc/rtc-digicolor.c | 5 +----
 drivers/rtc/rtc-ds1347.c    | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/rtc/rtc-digicolor.c b/drivers/rtc/rtc-digicolor.c
index b253bf1..1e200a0 100644
--- a/drivers/rtc/rtc-digicolor.c
+++ b/drivers/rtc/rtc-digicolor.c
@@ -202,10 +202,7 @@ static int __init dc_rtc_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, rtc);
 	rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, pdev->name,
 						&dc_rtc_ops, THIS_MODULE);
-	if (IS_ERR(rtc->rtc_dev))
-		return PTR_ERR(rtc->rtc_dev);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(rtc->rtc_dev);
 }
 
 static const struct of_device_id dc_dt_ids[] = {
diff --git a/drivers/rtc/rtc-ds1347.c b/drivers/rtc/rtc-ds1347.c
index ccfc9d4..9a02ca7 100644
--- a/drivers/rtc/rtc-ds1347.c
+++ b/drivers/rtc/rtc-ds1347.c
@@ -155,10 +155,7 @@ static int ds1347_probe(struct spi_device *spi)
 	rtc = devm_rtc_device_register(&spi->dev, "ds1347",
 				&ds1347_rtc_ops, THIS_MODULE);
 
-	if (IS_ERR(rtc))
-		return PTR_ERR(rtc);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(rtc);
 }
 
 static struct spi_driver ds1347_driver = {
-- 
2.7.4

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

* [PATCH] rtc: Use PTR_ERR_OR_ZERO
@ 2017-08-29 13:46 ` Himanshu Jha
  0 siblings, 0 replies; 6+ messages in thread
From: Himanshu Jha @ 2017-08-29 13:46 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
 drivers/rtc/rtc-digicolor.c | 5 +----
 drivers/rtc/rtc-ds1347.c    | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/rtc/rtc-digicolor.c b/drivers/rtc/rtc-digicolor.c
index b253bf1..1e200a0 100644
--- a/drivers/rtc/rtc-digicolor.c
+++ b/drivers/rtc/rtc-digicolor.c
@@ -202,10 +202,7 @@ static int __init dc_rtc_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, rtc);
 	rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, pdev->name,
 						&dc_rtc_ops, THIS_MODULE);
-	if (IS_ERR(rtc->rtc_dev))
-		return PTR_ERR(rtc->rtc_dev);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(rtc->rtc_dev);
 }
 
 static const struct of_device_id dc_dt_ids[] = {
diff --git a/drivers/rtc/rtc-ds1347.c b/drivers/rtc/rtc-ds1347.c
index ccfc9d4..9a02ca7 100644
--- a/drivers/rtc/rtc-ds1347.c
+++ b/drivers/rtc/rtc-ds1347.c
@@ -155,10 +155,7 @@ static int ds1347_probe(struct spi_device *spi)
 	rtc = devm_rtc_device_register(&spi->dev, "ds1347",
 				&ds1347_rtc_ops, THIS_MODULE);
 
-	if (IS_ERR(rtc))
-		return PTR_ERR(rtc);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(rtc);
 }
 
 static struct spi_driver ds1347_driver = {
-- 
2.7.4

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

* Re: [PATCH] rtc: Use PTR_ERR_OR_ZERO
  2017-08-29 13:46 ` Himanshu Jha
@ 2017-08-29 14:20   ` Alexandre Belloni
  -1 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2017-08-29 14:20 UTC (permalink / raw)
  To: Himanshu Jha; +Cc: a.zummo, baruch, linux-rtc, linux-arm-kernel, linux-kernel

Hi,

On 29/08/2017 at 19:16:59 +0530, Himanshu Jha wrote:
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 

I'm not taking that kind of useless changes (especially since it make
the code less readable) unless you have other significant improvement in
those drivers.

> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> ---
>  drivers/rtc/rtc-digicolor.c | 5 +----
>  drivers/rtc/rtc-ds1347.c    | 5 +----
>  2 files changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-digicolor.c b/drivers/rtc/rtc-digicolor.c
> index b253bf1..1e200a0 100644
> --- a/drivers/rtc/rtc-digicolor.c
> +++ b/drivers/rtc/rtc-digicolor.c
> @@ -202,10 +202,7 @@ static int __init dc_rtc_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, rtc);
>  	rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, pdev->name,
>  						&dc_rtc_ops, THIS_MODULE);
> -	if (IS_ERR(rtc->rtc_dev))
> -		return PTR_ERR(rtc->rtc_dev);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(rtc->rtc_dev);
>  }
>  
>  static const struct of_device_id dc_dt_ids[] = {
> diff --git a/drivers/rtc/rtc-ds1347.c b/drivers/rtc/rtc-ds1347.c
> index ccfc9d4..9a02ca7 100644
> --- a/drivers/rtc/rtc-ds1347.c
> +++ b/drivers/rtc/rtc-ds1347.c
> @@ -155,10 +155,7 @@ static int ds1347_probe(struct spi_device *spi)
>  	rtc = devm_rtc_device_register(&spi->dev, "ds1347",
>  				&ds1347_rtc_ops, THIS_MODULE);
>  
> -	if (IS_ERR(rtc))
> -		return PTR_ERR(rtc);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(rtc);
>  }
>  
>  static struct spi_driver ds1347_driver = {
> -- 
> 2.7.4
> 

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

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

* [PATCH] rtc: Use PTR_ERR_OR_ZERO
@ 2017-08-29 14:20   ` Alexandre Belloni
  0 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2017-08-29 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 29/08/2017 at 19:16:59 +0530, Himanshu Jha wrote:
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 

I'm not taking that kind of useless changes (especially since it make
the code less readable) unless you have other significant improvement in
those drivers.

> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> ---
>  drivers/rtc/rtc-digicolor.c | 5 +----
>  drivers/rtc/rtc-ds1347.c    | 5 +----
>  2 files changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-digicolor.c b/drivers/rtc/rtc-digicolor.c
> index b253bf1..1e200a0 100644
> --- a/drivers/rtc/rtc-digicolor.c
> +++ b/drivers/rtc/rtc-digicolor.c
> @@ -202,10 +202,7 @@ static int __init dc_rtc_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, rtc);
>  	rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, pdev->name,
>  						&dc_rtc_ops, THIS_MODULE);
> -	if (IS_ERR(rtc->rtc_dev))
> -		return PTR_ERR(rtc->rtc_dev);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(rtc->rtc_dev);
>  }
>  
>  static const struct of_device_id dc_dt_ids[] = {
> diff --git a/drivers/rtc/rtc-ds1347.c b/drivers/rtc/rtc-ds1347.c
> index ccfc9d4..9a02ca7 100644
> --- a/drivers/rtc/rtc-ds1347.c
> +++ b/drivers/rtc/rtc-ds1347.c
> @@ -155,10 +155,7 @@ static int ds1347_probe(struct spi_device *spi)
>  	rtc = devm_rtc_device_register(&spi->dev, "ds1347",
>  				&ds1347_rtc_ops, THIS_MODULE);
>  
> -	if (IS_ERR(rtc))
> -		return PTR_ERR(rtc);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(rtc);
>  }
>  
>  static struct spi_driver ds1347_driver = {
> -- 
> 2.7.4
> 

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

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

* Re: [PATCH] rtc: Use PTR_ERR_OR_ZERO
  2017-08-29 14:20   ` Alexandre Belloni
@ 2017-08-29 14:44     ` Himanshu Jha
  -1 siblings, 0 replies; 6+ messages in thread
From: Himanshu Jha @ 2017-08-29 14:44 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: a.zummo, baruch, linux-rtc, linux-arm-kernel, linux-kernel

On Tue, Aug 29, 2017 at 04:20:11PM +0200, Alexandre Belloni wrote:
> Hi,
> 
> On 29/08/2017 at 19:16:59 +0530, Himanshu Jha wrote:
> > Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> > 
> 
> I'm not taking that kind of useless changes (especially since it make
> the code less readable) unless you have other significant improvement in
> those drivers.

Apologies!! I got this change accepted in staging, and didn't think
about it's readability.


Thanks


> 
> > Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> > ---
> >  drivers/rtc/rtc-digicolor.c | 5 +----
> >  drivers/rtc/rtc-ds1347.c    | 5 +----
> >  2 files changed, 2 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/rtc/rtc-digicolor.c b/drivers/rtc/rtc-digicolor.c
> > index b253bf1..1e200a0 100644
> > --- a/drivers/rtc/rtc-digicolor.c
> > +++ b/drivers/rtc/rtc-digicolor.c
> > @@ -202,10 +202,7 @@ static int __init dc_rtc_probe(struct platform_device *pdev)
> >  	platform_set_drvdata(pdev, rtc);
> >  	rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, pdev->name,
> >  						&dc_rtc_ops, THIS_MODULE);
> > -	if (IS_ERR(rtc->rtc_dev))
> > -		return PTR_ERR(rtc->rtc_dev);
> > -
> > -	return 0;
> > +	return PTR_ERR_OR_ZERO(rtc->rtc_dev);
> >  }
> >  
> >  static const struct of_device_id dc_dt_ids[] = {
> > diff --git a/drivers/rtc/rtc-ds1347.c b/drivers/rtc/rtc-ds1347.c
> > index ccfc9d4..9a02ca7 100644
> > --- a/drivers/rtc/rtc-ds1347.c
> > +++ b/drivers/rtc/rtc-ds1347.c
> > @@ -155,10 +155,7 @@ static int ds1347_probe(struct spi_device *spi)
> >  	rtc = devm_rtc_device_register(&spi->dev, "ds1347",
> >  				&ds1347_rtc_ops, THIS_MODULE);
> >  
> > -	if (IS_ERR(rtc))
> > -		return PTR_ERR(rtc);
> > -
> > -	return 0;
> > +	return PTR_ERR_OR_ZERO(rtc);
> >  }
> >  
> >  static struct spi_driver ds1347_driver = {
> > -- 
> > 2.7.4
> > 
> 
> -- 
> Alexandre Belloni, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com

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

* [PATCH] rtc: Use PTR_ERR_OR_ZERO
@ 2017-08-29 14:44     ` Himanshu Jha
  0 siblings, 0 replies; 6+ messages in thread
From: Himanshu Jha @ 2017-08-29 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 29, 2017 at 04:20:11PM +0200, Alexandre Belloni wrote:
> Hi,
> 
> On 29/08/2017 at 19:16:59 +0530, Himanshu Jha wrote:
> > Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> > 
> 
> I'm not taking that kind of useless changes (especially since it make
> the code less readable) unless you have other significant improvement in
> those drivers.

Apologies!! I got this change accepted in staging, and didn't think
about it's readability.


Thanks


> 
> > Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> > ---
> >  drivers/rtc/rtc-digicolor.c | 5 +----
> >  drivers/rtc/rtc-ds1347.c    | 5 +----
> >  2 files changed, 2 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/rtc/rtc-digicolor.c b/drivers/rtc/rtc-digicolor.c
> > index b253bf1..1e200a0 100644
> > --- a/drivers/rtc/rtc-digicolor.c
> > +++ b/drivers/rtc/rtc-digicolor.c
> > @@ -202,10 +202,7 @@ static int __init dc_rtc_probe(struct platform_device *pdev)
> >  	platform_set_drvdata(pdev, rtc);
> >  	rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, pdev->name,
> >  						&dc_rtc_ops, THIS_MODULE);
> > -	if (IS_ERR(rtc->rtc_dev))
> > -		return PTR_ERR(rtc->rtc_dev);
> > -
> > -	return 0;
> > +	return PTR_ERR_OR_ZERO(rtc->rtc_dev);
> >  }
> >  
> >  static const struct of_device_id dc_dt_ids[] = {
> > diff --git a/drivers/rtc/rtc-ds1347.c b/drivers/rtc/rtc-ds1347.c
> > index ccfc9d4..9a02ca7 100644
> > --- a/drivers/rtc/rtc-ds1347.c
> > +++ b/drivers/rtc/rtc-ds1347.c
> > @@ -155,10 +155,7 @@ static int ds1347_probe(struct spi_device *spi)
> >  	rtc = devm_rtc_device_register(&spi->dev, "ds1347",
> >  				&ds1347_rtc_ops, THIS_MODULE);
> >  
> > -	if (IS_ERR(rtc))
> > -		return PTR_ERR(rtc);
> > -
> > -	return 0;
> > +	return PTR_ERR_OR_ZERO(rtc);
> >  }
> >  
> >  static struct spi_driver ds1347_driver = {
> > -- 
> > 2.7.4
> > 
> 
> -- 
> Alexandre Belloni, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com

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

end of thread, other threads:[~2017-08-29 14:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-29 13:46 [PATCH] rtc: Use PTR_ERR_OR_ZERO Himanshu Jha
2017-08-29 13:46 ` Himanshu Jha
2017-08-29 14:20 ` Alexandre Belloni
2017-08-29 14:20   ` Alexandre Belloni
2017-08-29 14:44   ` Himanshu Jha
2017-08-29 14:44     ` Himanshu Jha

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.