From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Troubles with smatch and jiffies
Date: Mon, 22 Feb 2016 15:35:52 -0300 [thread overview]
Message-ID: <20160222153552.6f318bcb@recife.lan> (raw)
Hi Dan,
I'm having some things that look like false positives when testing the media
drivers against smatch. This is bothering me for some time, but, as this was
harder to debug (as I needed to do a build with -j1), I postponed trying to
fix it for a while.
Basically, smatch is complaining for things like:
time_before(jiffies, jiffies + msecs_to_jiffies(var));
I noticed the very same behavior on two places:
drivers/media/pci/ivtv/ivtv-mailbox.c
drivers/media/rc/ati_remote.c
The enclosed patch makes smatch to shut up for ivtv build, but, IMHO,
we should make it stop making it complain about it globalwide, as the
same warning may also be appearing on other places.
FYI, I'm using here gcc (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2) and the
very latest version of smatch from git://repo.or.cz/smatch.git.
Regards,
Mauro
--
Thanks,
Mauro
commit 6a4d1872a94ba8450c9aff6599d1e86b515fd2a9
Author: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Date: Mon Feb 22 14:55:14 2016 -0300
ivtv-mailbox: avoid confusing smatch
The current logic causes smatch to be confused:
include/linux/jiffies.h:359:41: error: strange non-value function or array
include/linux/jiffies.h:361:42: error: strange non-value function or array
include/linux/jiffies.h:359:41: error: strange non-value function or array
include/linux/jiffies.h:361:42: error: strange non-value function or array
Use a different logic.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/drivers/media/pci/ivtv/ivtv-mailbox.c b/drivers/media/pci/ivtv/ivtv-mailbox.c
index e3ce96763785..4d6a3ad265a5 100644
--- a/drivers/media/pci/ivtv/ivtv-mailbox.c
+++ b/drivers/media/pci/ivtv/ivtv-mailbox.c
@@ -177,8 +177,10 @@ static int get_mailbox(struct ivtv *itv, struct ivtv_mailbox_data *mbdata, int f
/* Sleep before a retry, if not atomic */
if (!(flags & API_NO_WAIT_MB)) {
- if (time_after(jiffies,
- then + msecs_to_jiffies(10*retries)))
+ unsigned int timeout;
+
+ timeout = msecs_to_jiffies(10 * retries);
+ if (time_after(jiffies, then + timeout))
break;
ivtv_msleep_timeout(10, 0);
}
next reply other threads:[~2016-02-22 18:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 18:35 Mauro Carvalho Chehab [this message]
2016-02-25 11:20 ` Troubles with smatch and jiffies Dan Carpenter
2016-03-07 10:05 ` Dan Carpenter
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=20160222153552.6f318bcb@recife.lan \
--to=mchehab@osg.samsung.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-kernel@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