* Troubles with smatch and jiffies
@ 2016-02-22 18:35 Mauro Carvalho Chehab
2016-02-25 11:20 ` Dan Carpenter
2016-03-07 10:05 ` Dan Carpenter
0 siblings, 2 replies; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2016-02-22 18:35 UTC (permalink / raw)
To: Dan Carpenter; +Cc: LKML
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);
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-07 10:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22 18:35 Troubles with smatch and jiffies Mauro Carvalho Chehab
2016-02-25 11:20 ` Dan Carpenter
2016-03-07 10:05 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox