All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] rtc: m48t59: use generic nvmem
@ 2018-02-20  9:00 Dan Carpenter
  2018-02-21 14:30 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-02-20  9:00 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: linux-rtc

Hello Alexandre Belloni,

This is a semi-automatic email about new static checker warnings.

The patch ce0e0076da3e: "rtc: m48t59: use generic nvmem" from Feb 12, 
2018, leads to the following Smatch complaint:

    drivers/rtc/rtc-m48t59.c:409 m48t59_rtc_probe()
    warn: variable dereferenced before check 'pdata' (see line 391)

drivers/rtc/rtc-m48t59.c
   390			.stride = 1,
   391			.size = pdata->offset,
                                ^^^^^^^^^^^^^
New dereference.

   392			.reg_read = m48t59_nvram_read,
   393			.reg_write = m48t59_nvram_write,
   394			.priv = pdev,
   395		};
   396	
   397		/* This chip could be memory-mapped or I/O-mapped */
   398		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   399		if (!res) {
   400			res = platform_get_resource(pdev, IORESOURCE_IO, 0);
   401			if (!res)
   402				return -EINVAL;
   403		}
   404	
   405		if (res->flags & IORESOURCE_IO) {
   406			/* If we are I/O-mapped, the platform should provide
   407			 * the operations accessing chip registers.
   408			 */
   409			if (!pdata || !pdata->write_byte || !pdata->read_byte)
                             ^^^^^
The existing code assumed "pdata" could be NULL.

   410				return -EINVAL;
   411		} else if (res->flags & IORESOURCE_MEM) {

regards,
dan carpenter

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

end of thread, other threads:[~2018-02-21 14:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-20  9:00 [bug report] rtc: m48t59: use generic nvmem Dan Carpenter
2018-02-21 14:30 ` Alexandre Belloni

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.