staging: lustre: lmv: rewrite the right hand side of an assignment
authorAya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Thu, 26 Feb 2015 09:44:40 +0000 (11:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Feb 2015 23:24:16 +0000 (15:24 -0800)
This patch rewrites the right hand side of an assignment for
expressions of the form:
a = (a <op> b);
to be:
a <op>= b;
where <op> = << | >>.

This issue was detected and resolved using the following
coccinelle script:

@@
identifier i;
expression e;
@@

-i = (i >> e);
+i >>= e;

@@
identifier i;
expression e;
@@

-i = (i << e);
+i <<= e;

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/lmv/lmv_obd.c

index b779f47384c52053eeee5a3147280ad141e85f5a..6e446ac8d9e75aff25c216af30419ad7198c8aa8 100644 (file)
@@ -487,7 +487,7 @@ static int lmv_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
                __u32 oldsize = 0;
 
                while (newsize < index + 1)
-                       newsize = newsize << 1;
+                       newsize <<= 1;
                OBD_ALLOC(newtgts, sizeof(*newtgts) * newsize);
                if (newtgts == NULL) {
                        lmv_init_unlock(lmv);