]> git.sur5r.net Git - u-boot/commitdiff
cmd/tpm_test: Fix misleading code indentation
authorStefan Brüns <stefan.bruens@rwth-aachen.de>
Sun, 16 Oct 2016 15:13:55 +0000 (17:13 +0200)
committerSimon Glass <sjg@chromium.org>
Fri, 2 Dec 2016 17:37:47 +0000 (10:37 -0700)
GCC 6.2 reasonably complains about the current code:

../cmd/tpm_test.c: In function ‘do_tpmtest’:
../cmd/tpm_test.c:540:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
   for (i = 0; i < argc; i++)
   ^~~
../cmd/tpm_test.c:542:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘for’
    printf("\n------\n");
    ^~~~~~

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Updated to remove C99 variable decl:
Signed-off-by: Simon Glass <sjg@chromium.org>
cmd/tpm_test.c

index 65332d11177791a7796e6bec5c38b20aa8728b6c..330640594879d138a2d4b279f77d07c016d03b00 100644 (file)
@@ -532,15 +532,15 @@ static cmd_tbl_t cmd_cros_tpm_sub[] = {
 static int do_tpmtest(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        cmd_tbl_t *c;
+       int i;
 
        printf("argc = %d, argv = ", argc);
-       do {
-               int i = 0;
 
-               for (i = 0; i < argc; i++)
-                       printf(" %s", argv[i]);
-                       printf("\n------\n");
-               } while (0);
+       for (i = 0; i < argc; i++)
+               printf(" %s", argv[i]);
+
+       printf("\n------\n");
+
        argc--;
        argv++;
        c = find_cmd_tbl(argv[0], cmd_cros_tpm_sub,