]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
test: cmd: mbr: Remove unreachable code
authorAlexander Gendin <agendin@matrox.com>
Wed, 8 Nov 2023 03:05:19 +0000 (03:05 +0000)
committerTom Rini <trini@konsulko.com>
Fri, 10 Nov 2023 16:01:10 +0000 (11:01 -0500)
Fix an issue reported by Coverity scan, and fix code indentation.

Addresses-Coverity-ID: 467404 ("Control flow issues (DEADCODE)")
Signed-off-by: Alexander Gendin <agendin@matrox.com>
test/cmd/mbr.c

index 5d7402154d180e98a8e0c92b8f9feba66435a10f..46b78e706ca2a4e7e5feb28cacd13d54f4868108 100644 (file)
@@ -205,16 +205,14 @@ static unsigned build_mbr_parts(char *buf, size_t buf_size, unsigned num_parts)
                                        bytes_remaining -= cur_str_size;
 
                                }
-                       else if (num_parts == 5) {
-                               cur_str_size = sizeof(mbr_parts_p5);
-                               if (cur_str_size + 1 > bytes_remaining)
-                                       return 1;
-                               strcat(cur_buf, mbr_parts_p5);
-                               bytes_remaining -= cur_str_size;
+                               else if (num_parts == 5) {
+                                       cur_str_size = sizeof(mbr_parts_p5);
+                                       if (cur_str_size + 1 > bytes_remaining)
+                                               return 1;
+                                       strcat(cur_buf, mbr_parts_p5);
+                                       bytes_remaining -= cur_str_size;
 
-                       }
-                       else if (num_parts > 5)
-                               return 1;
+                               }
                        }
                }
        }