public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alexander Gendin <agendin@matrox.com>
To: "u-boot@lists.denx.de" <u-boot@lists.denx.de>
Cc: Tom Rini <trini@konsulko.com>
Subject: [PATCH] test: cmd: mbr: Remove unreachable code
Date: Wed, 8 Nov 2023 03:05:19 +0000	[thread overview]
Message-ID: <ZUr67-KKyaSDv_vk@alg-gentoo> (raw)

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

Reported-by: Coverity (CID 467404)
Signed-off-by: Alexander Gendin <agendin@matrox.com>
---
 test/cmd/mbr.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c
index 5d7402154d..46b78e706c 100644
--- a/test/cmd/mbr.c
+++ b/test/cmd/mbr.c
@@ -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;
+				}
 			}
 		}
 	}
-- 
2.41.0

             reply	other threads:[~2023-11-08  3:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-08  3:05 Alexander Gendin [this message]
2023-11-10 16:21 ` [PATCH] test: cmd: mbr: Remove unreachable code Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZUr67-KKyaSDv_vk@alg-gentoo \
    --to=agendin@matrox.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox