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


Groups > linux.kernel > #1337336 > unrolled thread

[PATCH] IB/rxe: fix compare_const_fl.cocci warnings

Started byJulia Lawall <julia.lawall@lip6.fr>
First post2016-02-18 14:10 +0100
Last post2016-02-18 18:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] IB/rxe: fix compare_const_fl.cocci warnings Julia Lawall <julia.lawall@lip6.fr> - 2016-02-18 14:10 +0100
    Re: [PATCH] IB/rxe: fix compare_const_fl.cocci warnings Doug Ledford <dledford@redhat.com> - 2016-02-18 18:00 +0100

#1337336 — [PATCH] IB/rxe: fix compare_const_fl.cocci warnings

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-02-18 14:10 +0100
Subject[PATCH] IB/rxe: fix compare_const_fl.cocci warnings
Message-ID<r3wvg-5Xo-3@gated-at.bofh.it>
Move constants to the right of binary operators.

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

CC: Kamal Heib <kamalh@mellanox.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
---

The constants on the right look a bit nicer.  Another possibility would be
!!.

tree:   https://github.com/dledford/linux.git rxe-v2
head:   bc91f3e63df667e8da8894a51149a2fc9acf0e71
commit: 30e5584cf453cd90bbcd3ebb5f3e774c0195dd83 [30/31] IB/rxe: Add
Soft-RoCE to kbuild and makefiles

 rxe_mr.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/staging/rdma/rxe/rxe_mr.c
+++ b/drivers/staging/rdma/rxe/rxe_mr.c
@@ -43,8 +43,8 @@ static u8 rxe_get_key(void)

 	key = key << 1;

-	key |= (0 != (key & 0x100)) ^ (0 != (key & 0x10))
-		^ (0 != (key & 0x80)) ^ (0 != (key & 0x40));
+	key |= ((key & 0x100) != 0) ^ ((key & 0x10) != 0)
+		^ ((key & 0x80) != 0) ^ ((key & 0x40) != 0);

 	key &= 0xff;

[toc] | [next] | [standalone]


#1337531

FromDoug Ledford <dledford@redhat.com>
Date2016-02-18 18:00 +0100
Message-ID<r3A5R-8tj-23@gated-at.bofh.it>
In reply to#1337336

[Multipart message — attachments visible in raw view] — view raw

On 2/18/2016 8:06 AM, Julia Lawall wrote:
> Move constants to the right of binary operators.
> 
> Generated by: scripts/coccinelle/misc/compare_const_fl.cocci
> 
> CC: Kamal Heib <kamalh@mellanox.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
> ---
> 
> The constants on the right look a bit nicer.  Another possibility would be
> !!.
> 
> tree:   https://github.com/dledford/linux.git rxe-v2
> head:   bc91f3e63df667e8da8894a51149a2fc9acf0e71
> commit: 30e5584cf453cd90bbcd3ebb5f3e774c0195dd83 [30/31] IB/rxe: Add
> Soft-RoCE to kbuild and makefiles
> 
>  rxe_mr.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- a/drivers/staging/rdma/rxe/rxe_mr.c
> +++ b/drivers/staging/rdma/rxe/rxe_mr.c
> @@ -43,8 +43,8 @@ static u8 rxe_get_key(void)
> 
>  	key = key << 1;
> 
> -	key |= (0 != (key & 0x100)) ^ (0 != (key & 0x10))
> -		^ (0 != (key & 0x80)) ^ (0 != (key & 0x40));
> +	key |= ((key & 0x100) != 0) ^ ((key & 0x10) != 0)
> +		^ ((key & 0x80) != 0) ^ ((key & 0x40) != 0);
> 
>  	key &= 0xff;
> 

Thanks, applied to my rxe-v2 branch.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web