From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754627AbdH2OoT (ORCPT ); Tue, 29 Aug 2017 10:44:19 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35575 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753582AbdH2OoR (ORCPT ); Tue, 29 Aug 2017 10:44:17 -0400 X-Google-Smtp-Source: ADKCNb6a2ohN/VwriSf/ngTl2EDrLT87NKiZaTiroZRJcqQrbVmEqQG/NNX1W8YS8lKV0s8pRQp18g== Date: Tue, 29 Aug 2017 20:14:04 +0530 From: Himanshu Jha To: Alexandre Belloni Cc: a.zummo@towertech.it, baruch@tkos.co.il, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rtc: Use PTR_ERR_OR_ZERO Message-ID: <20170829144404.GA19791@himanshu-Vostro-3559> References: <1504014419-16894-1-git-send-email-himanshujha199640@gmail.com> <20170829142011.76w67w64a7lheef4@piout.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170829142011.76w67w64a7lheef4@piout.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > --- > > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: himanshujha199640@gmail.com (Himanshu Jha) Date: Tue, 29 Aug 2017 20:14:04 +0530 Subject: [PATCH] rtc: Use PTR_ERR_OR_ZERO In-Reply-To: <20170829142011.76w67w64a7lheef4@piout.net> References: <1504014419-16894-1-git-send-email-himanshujha199640@gmail.com> <20170829142011.76w67w64a7lheef4@piout.net> Message-ID: <20170829144404.GA19791@himanshu-Vostro-3559> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org 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 > > --- > > 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