LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 3/9] drivers/char/isicom.c: Correct use of ! and &
@ 2008-02-26 20:43 Julia Lawall
0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2008-02-26 20:43 UTC (permalink / raw)
To: jirislaby, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
In commit e6bafba5b4765a5a252f1b8d31cbf6d2459da337, a bug was fixed that
involved converting !x & y to !(x & y). The code below shows the same
pattern, and thus should perhaps be fixed in the same way.
This is not tested and clearly changes the semantics, so it is only
something to consider.
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@@ expression E1,E2; @@
(
!E1 & !E2
|
- !E1 & E2
+ !(E1 & E2)
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
diff -u -p a/drivers/char/isicom.c b/drivers/char/isicom.c
--- a/drivers/char/isicom.c 2007-10-22 11:25:05.000000000 +0200
+++ b/drivers/char/isicom.c 2008-02-26 08:01:56.000000000 +0100
@@ -1527,7 +1527,7 @@ static int __devinit reset_card(struct p
msleep(10);
portcount = inw(base + 0x2);
- if (!inw(base + 0xe) & 0x1 || (portcount != 0 && portcount != 4 &&
+ if (!(inw(base + 0xe) & 0x1) || (portcount != 0 && portcount != 4 &&
portcount != 8 && portcount != 16)) {
dev_err(&pdev->dev, "ISILoad:PCI Card%d reset failure.\n",
card + 1);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-02-26 20:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-26 20:43 [PATCH 3/9] drivers/char/isicom.c: Correct use of ! and & Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).