* [PATCH 09/15] drivers: rtc: Drop unlikely before IS_ERR(_OR_NULL) [not found] <cover.1438331416.git.viresh.kumar@linaro.org> @ 2015-07-31 8:38 ` Viresh Kumar 2015-07-31 9:31 ` [PATCH] drivers: rtc: fix ptr_ret.cocci warnings Viresh Kumar 2015-07-31 10:53 ` [PATCH 9/15 V2] drivers: rtc: Drop (un)likely before IS_ERR(_OR_NULL) Viresh Kumar 0 siblings, 2 replies; 6+ messages in thread From: Viresh Kumar @ 2015-07-31 8:38 UTC (permalink / raw) To: linux-arm-kernel IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag and there is no need to do that again from its callers. Drop it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- drivers/rtc/interface.c | 2 +- drivers/rtc/rtc-bfin.c | 2 +- drivers/rtc/rtc-gemini.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 11b639067312..5836751b8203 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -564,7 +564,7 @@ enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer) void rtc_update_irq(struct rtc_device *rtc, unsigned long num, unsigned long events) { - if (unlikely(IS_ERR_OR_NULL(rtc))) + if (IS_ERR_OR_NULL(rtc)) return; pm_stay_awake(rtc->dev.parent); diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index 3d44b11721ea..535a5f9338d0 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c @@ -361,7 +361,7 @@ static int bfin_rtc_probe(struct platform_device *pdev) /* Register our RTC with the RTC framework */ rtc->rtc_dev = devm_rtc_device_register(dev, pdev->name, &bfin_rtc_ops, THIS_MODULE); - if (unlikely(IS_ERR(rtc->rtc_dev))) + if (IS_ERR(rtc->rtc_dev)) return PTR_ERR(rtc->rtc_dev); /* Grab the IRQ and init the hardware */ diff --git a/drivers/rtc/rtc-gemini.c b/drivers/rtc/rtc-gemini.c index 35f4486738fc..2fed93e1114a 100644 --- a/drivers/rtc/rtc-gemini.c +++ b/drivers/rtc/rtc-gemini.c @@ -148,7 +148,7 @@ static int gemini_rtc_probe(struct platform_device *pdev) rtc->rtc_dev = rtc_device_register(pdev->name, dev, &gemini_rtc_ops, THIS_MODULE); - if (likely(IS_ERR(rtc->rtc_dev))) + if (IS_ERR(rtc->rtc_dev)) return PTR_ERR(rtc->rtc_dev); return 0; -- 2.4.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] drivers: rtc: fix ptr_ret.cocci warnings 2015-07-31 8:38 ` [PATCH 09/15] drivers: rtc: Drop unlikely before IS_ERR(_OR_NULL) Viresh Kumar @ 2015-07-31 9:31 ` Viresh Kumar 2015-08-11 15:54 ` Alexandre Belloni 2015-07-31 10:53 ` [PATCH 9/15 V2] drivers: rtc: Drop (un)likely before IS_ERR(_OR_NULL) Viresh Kumar 1 sibling, 1 reply; 6+ messages in thread From: Viresh Kumar @ 2015-07-31 9:31 UTC (permalink / raw) To: linux-arm-kernel From: kbuild test robot <fengguang.wu@intel.com> drivers/rtc/rtc-gemini.c:151:1-3: WARNING: PTR_ERR_OR_ZERO can be used Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR Generated by: scripts/coccinelle/api/ptr_ret.cocci Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- Got a cleanup patch from Fengguang, maybe we can apply this too. rtc-gemini.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/drivers/rtc/rtc-gemini.c +++ b/drivers/rtc/rtc-gemini.c @@ -148,10 +148,7 @@ static int gemini_rtc_probe(struct platf rtc->rtc_dev = rtc_device_register(pdev->name, dev, &gemini_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 int gemini_rtc_remove(struct platform_device *pdev) ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] drivers: rtc: fix ptr_ret.cocci warnings 2015-07-31 9:31 ` [PATCH] drivers: rtc: fix ptr_ret.cocci warnings Viresh Kumar @ 2015-08-11 15:54 ` Alexandre Belloni 0 siblings, 0 replies; 6+ messages in thread From: Alexandre Belloni @ 2015-08-11 15:54 UTC (permalink / raw) To: linux-arm-kernel On 31/07/2015 at 15:01:04 +0530, Viresh Kumar wrote : > From: kbuild test robot <fengguang.wu@intel.com> > > drivers/rtc/rtc-gemini.c:151:1-3: WARNING: PTR_ERR_OR_ZERO can be used > > > Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR > > Generated by: scripts/coccinelle/api/ptr_ret.cocci > > Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > Got a cleanup patch from Fengguang, maybe we can apply this too. > > rtc-gemini.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > Applied, thanks. -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 9/15 V2] drivers: rtc: Drop (un)likely before IS_ERR(_OR_NULL) 2015-07-31 8:38 ` [PATCH 09/15] drivers: rtc: Drop unlikely before IS_ERR(_OR_NULL) Viresh Kumar 2015-07-31 9:31 ` [PATCH] drivers: rtc: fix ptr_ret.cocci warnings Viresh Kumar @ 2015-07-31 10:53 ` Viresh Kumar 2015-08-03 4:32 ` Hans Ulli Kroll 2015-08-11 15:54 ` Alexandre Belloni 1 sibling, 2 replies; 6+ messages in thread From: Viresh Kumar @ 2015-07-31 10:53 UTC (permalink / raw) To: linux-arm-kernel IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag and there is no need to do that again from its callers. Drop it. gemini driver was using likely() for a failure case while the rtc driver is getting registered. That looks wrong and it should really be unlikely. But because we are killing all the unlikely() flags, lets kill that too. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- V1->V2: - Removed the likely() part from gemini driver and the changelog wasn't updated to match that. Fixed the changelog now. drivers/rtc/interface.c | 2 +- drivers/rtc/rtc-bfin.c | 2 +- drivers/rtc/rtc-gemini.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 11b639067312..5836751b8203 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -564,7 +564,7 @@ enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer) void rtc_update_irq(struct rtc_device *rtc, unsigned long num, unsigned long events) { - if (unlikely(IS_ERR_OR_NULL(rtc))) + if (IS_ERR_OR_NULL(rtc)) return; pm_stay_awake(rtc->dev.parent); diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index 3d44b11721ea..535a5f9338d0 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c @@ -361,7 +361,7 @@ static int bfin_rtc_probe(struct platform_device *pdev) /* Register our RTC with the RTC framework */ rtc->rtc_dev = devm_rtc_device_register(dev, pdev->name, &bfin_rtc_ops, THIS_MODULE); - if (unlikely(IS_ERR(rtc->rtc_dev))) + if (IS_ERR(rtc->rtc_dev)) return PTR_ERR(rtc->rtc_dev); /* Grab the IRQ and init the hardware */ diff --git a/drivers/rtc/rtc-gemini.c b/drivers/rtc/rtc-gemini.c index 35f4486738fc..2fed93e1114a 100644 --- a/drivers/rtc/rtc-gemini.c +++ b/drivers/rtc/rtc-gemini.c @@ -148,7 +148,7 @@ static int gemini_rtc_probe(struct platform_device *pdev) rtc->rtc_dev = rtc_device_register(pdev->name, dev, &gemini_rtc_ops, THIS_MODULE); - if (likely(IS_ERR(rtc->rtc_dev))) + if (IS_ERR(rtc->rtc_dev)) return PTR_ERR(rtc->rtc_dev); return 0; -- 2.4.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 9/15 V2] drivers: rtc: Drop (un)likely before IS_ERR(_OR_NULL) 2015-07-31 10:53 ` [PATCH 9/15 V2] drivers: rtc: Drop (un)likely before IS_ERR(_OR_NULL) Viresh Kumar @ 2015-08-03 4:32 ` Hans Ulli Kroll 2015-08-11 15:54 ` Alexandre Belloni 1 sibling, 0 replies; 6+ messages in thread From: Hans Ulli Kroll @ 2015-08-03 4:32 UTC (permalink / raw) To: linux-arm-kernel Hi On Fri, 31 Jul 2015, Viresh Kumar wrote: > IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag and there > is no need to do that again from its callers. Drop it. > > gemini driver was using likely() for a failure case while the rtc driver > is getting registered. That looks wrong and it should really be > unlikely. But because we are killing all the unlikely() flags, lets kill > that too. > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > V1->V2: > - Removed the likely() part from gemini driver and the changelog wasn't > updated to match that. Fixed the changelog now. > > drivers/rtc/interface.c | 2 +- > drivers/rtc/rtc-bfin.c | 2 +- > drivers/rtc/rtc-gemini.c | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c > index 11b639067312..5836751b8203 100644 > --- a/drivers/rtc/interface.c > +++ b/drivers/rtc/interface.c > @@ -564,7 +564,7 @@ enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer) > void rtc_update_irq(struct rtc_device *rtc, > unsigned long num, unsigned long events) > { > - if (unlikely(IS_ERR_OR_NULL(rtc))) > + if (IS_ERR_OR_NULL(rtc)) > return; > > pm_stay_awake(rtc->dev.parent); > diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c > index 3d44b11721ea..535a5f9338d0 100644 > --- a/drivers/rtc/rtc-bfin.c > +++ b/drivers/rtc/rtc-bfin.c > @@ -361,7 +361,7 @@ static int bfin_rtc_probe(struct platform_device *pdev) > /* Register our RTC with the RTC framework */ > rtc->rtc_dev = devm_rtc_device_register(dev, pdev->name, &bfin_rtc_ops, > THIS_MODULE); > - if (unlikely(IS_ERR(rtc->rtc_dev))) > + if (IS_ERR(rtc->rtc_dev)) > return PTR_ERR(rtc->rtc_dev); > > /* Grab the IRQ and init the hardware */ > diff --git a/drivers/rtc/rtc-gemini.c b/drivers/rtc/rtc-gemini.c > index 35f4486738fc..2fed93e1114a 100644 > --- a/drivers/rtc/rtc-gemini.c > +++ b/drivers/rtc/rtc-gemini.c > @@ -148,7 +148,7 @@ static int gemini_rtc_probe(struct platform_device *pdev) > > rtc->rtc_dev = rtc_device_register(pdev->name, dev, > &gemini_rtc_ops, THIS_MODULE); > - if (likely(IS_ERR(rtc->rtc_dev))) > + if (IS_ERR(rtc->rtc_dev)) > return PTR_ERR(rtc->rtc_dev); > > return 0; > -- > 2.4.0 > > For the mach-gemini part Acked-by: Hans Ulli Kroll <ulli.kroll@googlemail.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 9/15 V2] drivers: rtc: Drop (un)likely before IS_ERR(_OR_NULL) 2015-07-31 10:53 ` [PATCH 9/15 V2] drivers: rtc: Drop (un)likely before IS_ERR(_OR_NULL) Viresh Kumar 2015-08-03 4:32 ` Hans Ulli Kroll @ 2015-08-11 15:54 ` Alexandre Belloni 1 sibling, 0 replies; 6+ messages in thread From: Alexandre Belloni @ 2015-08-11 15:54 UTC (permalink / raw) To: linux-arm-kernel On 31/07/2015 at 16:23:43 +0530, Viresh Kumar wrote : > IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag and there > is no need to do that again from its callers. Drop it. > > gemini driver was using likely() for a failure case while the rtc driver > is getting registered. That looks wrong and it should really be > unlikely. But because we are killing all the unlikely() flags, lets kill > that too. > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > V1->V2: > - Removed the likely() part from gemini driver and the changelog wasn't > updated to match that. Fixed the changelog now. > > drivers/rtc/interface.c | 2 +- > drivers/rtc/rtc-bfin.c | 2 +- > drivers/rtc/rtc-gemini.c | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > Applied, thanks. -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-08-11 15:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1438331416.git.viresh.kumar@linaro.org>
2015-07-31 8:38 ` [PATCH 09/15] drivers: rtc: Drop unlikely before IS_ERR(_OR_NULL) Viresh Kumar
2015-07-31 9:31 ` [PATCH] drivers: rtc: fix ptr_ret.cocci warnings Viresh Kumar
2015-08-11 15:54 ` Alexandre Belloni
2015-07-31 10:53 ` [PATCH 9/15 V2] drivers: rtc: Drop (un)likely before IS_ERR(_OR_NULL) Viresh Kumar
2015-08-03 4:32 ` Hans Ulli Kroll
2015-08-11 15:54 ` Alexandre Belloni
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox