git: a698c15a41af - main - loader: remove unneeded variable

From: Warner Losh <imp_at_FreeBSD.org>
Date: Sat, 21 Sep 2024 11:26:25 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=a698c15a41afca19f87e11d4f8ce5664f992673b

commit a698c15a41afca19f87e11d4f8ce5664f992673b
Author:     Ahmad Khalifa <ahmadkhalifa570@gmail.com>
AuthorDate: 2024-08-12 10:01:07 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-09-21 11:25:16 +0000

    loader: remove unneeded variable
    
    Reviewed by: imp, kib
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1381
---
 stand/efi/loader/copy.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c
index e5c950d75f37..3e466e875af8 100644
--- a/stand/efi/loader/copy.c
+++ b/stand/efi/loader/copy.c
@@ -220,11 +220,10 @@ command_copy_staging(int argc, char *argv[])
 		[COPY_STAGING_DISABLE] = "disable",
 		[COPY_STAGING_AUTO] = "auto",
 	};
-	int prev, res;
+	int prev;
 
-	res = CMD_OK;
 	if (argc > 2) {
-		res = CMD_ERROR;
+		return (CMD_ERROR);
 	} else if (argc == 2) {
 		prev = copy_staging;
 		if (strcmp(argv[1], "enable") == 0)
@@ -235,9 +234,9 @@ command_copy_staging(int argc, char *argv[])
 			copy_staging = COPY_STAGING_AUTO;
 		else {
 			printf("usage: copy_staging enable|disable|auto\n");
-			res = CMD_ERROR;
+			return (CMD_ERROR);
 		}
-		if (res == CMD_OK && prev != copy_staging) {
+		if (prev != copy_staging) {
 			printf("changed copy_staging, unloading kernel\n");
 			unload();
 			efi_copy_free();
@@ -246,7 +245,7 @@ command_copy_staging(int argc, char *argv[])
 	} else {
 		printf("copy staging: %s\n", mode[copy_staging]);
 	}
-	return (res);
+	return (CMD_OK);
 }
 COMMAND_SET(copy_staging, "copy_staging", "copy staging", command_copy_staging);
 #endif
@@ -256,18 +255,16 @@ command_staging_slop(int argc, char *argv[])
 {
 	char *endp;
 	u_long new, prev;
-	int res;
 
-	res = CMD_OK;
 	if (argc > 2) {
-		res = CMD_ERROR;
+		return (CMD_ERROR);
 	} else if (argc == 2) {
 		new = strtoul(argv[1], &endp, 0);
 		if (*endp != '\0') {
 			printf("invalid slop value\n");
-			res = CMD_ERROR;
+			return (CMD_ERROR);
 		}
-		if (res == CMD_OK && staging_slop != new) {
+		if (staging_slop != new) {
 			staging_slop = new;
 			printf("changed slop, unloading kernel\n");
 
@@ -278,7 +275,7 @@ command_staging_slop(int argc, char *argv[])
 	} else {
 		printf("staging slop %#lx\n", staging_slop);
 	}
-	return (res);
+	return (CMD_OK);
 }
 COMMAND_SET(staging_slop, "staging_slop", "set staging slop",
     command_staging_slop);