staging: rts5208: fix case of bitwise operator on zero in ms.c
authorJiayi Ye <yejiayily@gmail.com>
Mon, 20 Oct 2014 07:01:08 +0000 (15:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Oct 2014 06:10:49 +0000 (14:10 +0800)
commitb0ef3ed48eb8c1982c9d8b8063d856c83d116764
tree589404289ddcf0715fd1e647a83c573220e98192
parentcb6c1ee3057ebb717fd4439711b3cb5354d5085f
staging: rts5208: fix case of bitwise operator on zero in ms.c

If a variable has value 0, then there is no point in combining it with other things with |, as for any
 x, 0 | x is just x. The following semantic patch finds this problem.
    @@
    expression x,e,e1;
    statement S;
    @@

    if (x == 0) {
      <... when != x = e1
          when != while(...) S
          when != for(...;...;...) S
    (
    *  x |= e
    |
    *  x | e
    )
      ...>
    }

Signed-off-by: Jiayi Ye <yejiayily@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rts5208/ms.c