From: Dan Carpenter <dan.carpenter@oracle.com>
To: alexandre.belloni@bootlin.com
Cc: linux-rtc@vger.kernel.org
Subject: [bug report] rtc: m48t59: use generic nvmem
Date: Tue, 20 Feb 2018 12:00:25 +0300 [thread overview]
Message-ID: <20180220090025.GA20051@mwanda> (raw)
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
next reply other threads:[~2018-02-20 9:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 9:00 Dan Carpenter [this message]
2018-02-21 14:30 ` [bug report] rtc: m48t59: use generic nvmem Alexandre Belloni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180220090025.GA20051@mwanda \
--to=dan.carpenter@oracle.com \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-rtc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox