public inbox for linux-rtc@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] rtc: pxa: convert to use shared sa1100 functions
@ 2018-04-18 14:23 Dan Carpenter
  2018-04-18 15:58 ` Rob Herring
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2018-04-18 14:23 UTC (permalink / raw)
  To: robh; +Cc: linux-rtc

[ This code is several years old now.  - dan ]

Hello Rob Herring,

The patch 3cdf4ad9633e: "rtc: pxa: convert to use shared sa1100
functions" from May 13, 2015, leads to the following static checker
warning:

	drivers/rtc/rtc-pxa.c:368 pxa_rtc_probe()
	info: return a literal instead of 'ret'

drivers/rtc/rtc-pxa.c
   352          pxa_rtc->base = devm_ioremap(dev, pxa_rtc->ress->start,
   353                                  resource_size(pxa_rtc->ress));
   354          if (!pxa_rtc->base) {
   355                  dev_err(dev, "Unable to map pxa RTC I/O memory\n");
   356                  return -ENOMEM;
   357          }
   358  
   359          pxa_rtc_open(dev);
   360  
   361          sa1100_rtc->rcnr = pxa_rtc->base + 0x0;
   362          sa1100_rtc->rtsr = pxa_rtc->base + 0x8;
   363          sa1100_rtc->rtar = pxa_rtc->base + 0x4;
   364          sa1100_rtc->rttr = pxa_rtc->base + 0xc;
   365          ret = sa1100_rtc_init(pdev, sa1100_rtc);
   366          if (!ret) {
                    ^^^^
This test really looks like it's inverted to me.

   367                  dev_err(dev, "Unable to init SA1100 RTC sub-device\n");
   368                  return ret;
   369          }
   370  
   371          rtsr_clear_bits(pxa_rtc, RTSR_PIALE | RTSR_RDALE1 | RTSR_HZE);
   372  
   373          pxa_rtc->rtc = devm_rtc_device_register(&pdev->dev, "pxa-rtc",
   374                                                  &pxa_rtc_ops, THIS_MODULE);
   375          if (IS_ERR(pxa_rtc->rtc)) {
   376                  ret = PTR_ERR(pxa_rtc->rtc);
   377                  dev_err(dev, "Failed to register RTC device -> %d\n", ret);
   378                  return ret;
   379          }
   380  
   381          device_init_wakeup(dev, 1);
   382  
   383          return 0;


regards,
dan carpenter

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

* Re: [bug report] rtc: pxa: convert to use shared sa1100 functions
  2018-04-18 14:23 [bug report] rtc: pxa: convert to use shared sa1100 functions Dan Carpenter
@ 2018-04-18 15:58 ` Rob Herring
  2018-04-18 16:12   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2018-04-18 15:58 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: open list:REAL TIME CLOCK (RTC) SUBSYSTEM

On Wed, Apr 18, 2018 at 9:23 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> [ This code is several years old now.  - dan ]

Did I miss an earlier bug report?

> Hello Rob Herring,
>
> The patch 3cdf4ad9633e: "rtc: pxa: convert to use shared sa1100
> functions" from May 13, 2015, leads to the following static checker
> warning:
>
>         drivers/rtc/rtc-pxa.c:368 pxa_rtc_probe()
>         info: return a literal instead of 'ret'
>
> drivers/rtc/rtc-pxa.c
>    352          pxa_rtc->base = devm_ioremap(dev, pxa_rtc->ress->start,
>    353                                  resource_size(pxa_rtc->ress));
>    354          if (!pxa_rtc->base) {
>    355                  dev_err(dev, "Unable to map pxa RTC I/O memory\n");
>    356                  return -ENOMEM;
>    357          }
>    358
>    359          pxa_rtc_open(dev);
>    360
>    361          sa1100_rtc->rcnr = pxa_rtc->base + 0x0;
>    362          sa1100_rtc->rtsr = pxa_rtc->base + 0x8;
>    363          sa1100_rtc->rtar = pxa_rtc->base + 0x4;
>    364          sa1100_rtc->rttr = pxa_rtc->base + 0xc;
>    365          ret = sa1100_rtc_init(pdev, sa1100_rtc);
>    366          if (!ret) {
>                     ^^^^
> This test really looks like it's inverted to me.

Indeed. Nice to see no one seems to have noticed or care.

Rob

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

* Re: [bug report] rtc: pxa: convert to use shared sa1100 functions
  2018-04-18 15:58 ` Rob Herring
@ 2018-04-18 16:12   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2018-04-18 16:12 UTC (permalink / raw)
  To: Rob Herring; +Cc: open list:REAL TIME CLOCK (RTC) SUBSYSTEM

On Wed, Apr 18, 2018 at 10:58:08AM -0500, Rob Herring wrote:
> On Wed, Apr 18, 2018 at 9:23 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > [ This code is several years old now.  - dan ]
> 
> Did I miss an earlier bug report?
> 

No.  It's a new-ish check and I hadn't reviewed all the non-x86 warnings
yet.  I was just thinking that it's weird to see such an old warning.

regards,
dan carpenter

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

end of thread, other threads:[~2018-04-18 16:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-18 14:23 [bug report] rtc: pxa: convert to use shared sa1100 functions Dan Carpenter
2018-04-18 15:58 ` Rob Herring
2018-04-18 16:12   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox