Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1267184

[PATCH] fix compare_const_fl.cocci warnings

From Julia Lawall <julia.lawall@lip6.fr>
Newsgroups linux.kernel
Subject [PATCH] fix compare_const_fl.cocci warnings
Date 2015-11-11 14:20 +0100
Message-ID <qtDtE-3fK-19@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Move constants to the right of binary operators.

Semantic patch information:
 Depends on personal taste in some cases.

Generated by: scripts/coccinelle/misc/compare_const_fl.cocci

CC: Dave Penkler <dpenkler@gmail.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>

---

This is what Coccinelle generates.  But it would really be more normal in
the form !(x&y).

 usbtmc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -494,7 +494,7 @@ static int usbtmc488_ioctl_simple(struct

 	dev = &data->intf->dev;

-	if (0 == (data->usb488_caps & USBTMC488_CAPABILITY_SIMPLE))
+	if ((data->usb488_caps & USBTMC488_CAPABILITY_SIMPLE) == 0)
 		return -EINVAL;

 	buffer = kmalloc(8, GFP_KERNEL);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] fix compare_const_fl.cocci warnings Julia Lawall <julia.lawall@lip6.fr> - 2015-11-11 14:20 +0100

csiph-web