[ktap] [PATCH] staging:ktap:loader.c fix coding style

  • From: Gokulnath A <gokul.linux@xxxxxxxxx>
  • To: gregkh@xxxxxxxxxxxxxxxxxxx, ktap@xxxxxxxxxxxxx, jovi.zhangwei@xxxxxxxxx
  • Date: Mon, 28 Oct 2013 00:43:04 +0530

fixed the errors and warnings generated by
checkpatch.pl script.

Signed-off-by: Gokulnath A <Gokulnath.Avanashilingam@xxxxxxxxxxxx>
---
 drivers/staging/ktap/interpreter/loader.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/ktap/interpreter/loader.c
b/drivers/staging/ktap/interpreter/loader.c
index 0da54d7..bd48714 100644
--- a/drivers/staging/ktap/interpreter/loader.c
+++ b/drivers/staging/ktap/interpreter/loader.c
@@ -43,11 +43,11 @@ struct load_state {
     do {    \
         memcpy(dst, &S->buff[S->pos], size);    \
         S->pos += size;    \
-    } while(0)
+    } while (0)

 #define NEW_VECTOR(S, size)    kp_malloc(S->ks, size)
-#define GET_CURRENT(S)        &S->buff[S->pos]
-#define ADD_POS(S, size)    S->pos += size
+#define GET_CURRENT(S)        (&S->buff[S->pos])
+#define ADD_POS(S, size)    (S->pos += size)


 static int load_function(struct load_state *S, ktap_proto *f);
@@ -101,7 +101,7 @@ static int load_code(struct load_state *S, ktap_proto *f)

 static int load_constants(struct load_state *S, ktap_proto *f)
 {
-    int i,n;
+    int i, n;

     n = READ_INT(S);

@@ -110,7 +110,7 @@ static int load_constants(struct load_state *S,
ktap_proto *f)
     for (i = 0; i < n; i++)
         setnilvalue(&f->k[i]);

-    for (i=0; i < n; i++) {
+    for (i = 0; i < n; i++) {
         ktap_value *o = &f->k[i];

         int t = READ_CHAR(S);
@@ -132,10 +132,9 @@ static int load_constants(struct load_state *S,
ktap_proto *f)
             setsvalue(o, READ_STRING(S));
             break;
         default:
-            kp_error(S->ks, "ktap: load_constants: "
-                    "unknow ktap_value\n");
+            kp_error(S->ks,
+            "ktap: load_constants:unknow ktap_value\n");
             return -1;
-
         }
     }

@@ -156,7 +155,7 @@ static int load_constants(struct load_state *S,
ktap_proto *f)

 static int load_upvalues(struct load_state *S, ktap_proto *f)
 {
-    int i,n;
+    int i, n;

     n = READ_INT(S);
     f->upvalues = NEW_VECTOR(S, n * sizeof(ktap_upvaldesc));
@@ -175,7 +174,7 @@ static int load_upvalues(struct load_state *S,
ktap_proto *f)

 static int load_debuginfo(struct load_state *S, ktap_proto *f)
 {
-    int i,n;
+    int i, n;

     f->source = READ_STRING(S);
     n = READ_INT(S);
@@ -202,7 +201,7 @@ static int load_debuginfo(struct load_state *S,
ktap_proto *f)
 static int load_function(struct load_state *S, ktap_proto *f)
 {
     f->linedefined = READ_INT(S);
-     f->lastlinedefined = READ_INT(S);
+    f->lastlinedefined = READ_INT(S);
     f->numparams = READ_BYTE(S);
     f->is_vararg = READ_BYTE(S);
     f->maxstacksize = READ_BYTE(S);
@@ -224,8 +223,8 @@ static int load_function(struct load_state *S,
ktap_proto *f)

 #define N0    KTAPC_HEADERSIZE
 #define N1    (sizeof(KTAP_SIGNATURE) - sizeof(char))
-#define N2    N1 + 2
-#define N3    N2 + 6
+#define N2    (N1 + 2)
+#define N3    (N2 + 6)

 static int load_header(struct load_state *S)
 {
@@ -244,7 +243,7 @@ static int load_header(struct load_state *S)
     else if (memcmp(h, s, N3) != 0)
         error(S, "incompatible");
     else
-        error(S,"corrupted");
+        error(S, "corrupted");

     return -1;
 }
-- 
1.8.1.2

Other related posts: