Skip to contentSkip to conversation

test: cmd: mbr: Remove unreachable code

PATCH In review Alexander Gendin 2 participants 2 messages Nov 8, 2023 – Nov 10, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test: cmd: mbr: Remove unreachable code

Fix Coverity (CID 467404): Control flow issues (DEADCODE). Fix code indentation.

Reported-by Coverity (CID 467404)
---
 test/cmd/mbr.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
test/cmd/mbr.c +7 -9
index 5d7402154d..46b78e706c 100644
@@ -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;
+				}
 			}
 		}
 	}
Signature · 1 line
2.41.0
#1 lore raw
Quoted 5 lines · Alexander Gendin

Fix Coverity (CID 467404): Control flow issues (DEADCODE). Fix code indentation.

Reported-by Coverity (CID 467404)

Applied to u-boot/master, thanks!

Signature · 1 line
Tom