mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/boot/KASLR: Change the function type to void
@ 2018-08-07  1:57 Chao Fan
  2018-09-11  6:20 ` [tip:x86/boot] x86/boot/KASLR: Remove return value from handle_mem_options() tip-bot for Chao Fan
  0 siblings, 1 reply; 2+ messages in thread
From: Chao Fan @ 2018-08-07  1:57 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86, kirill.shutemov, bhe, linux-kernel
  Cc: douly.fnst, Chao Fan

Since function "handle_mem_options" is used only once:
arch/x86/boot/compressed/kaslr.c:421
	handle_mem_options();
The return value is useless, so change it to void.

And also clean a useless variable.

Suggested-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
Signed-off-by: Chao Fan <fanc.fnst@cn.fujitsu.com>
---
 arch/x86/boot/compressed/kaslr.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 302517929932..78724caadcfb 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -244,7 +244,7 @@ static void parse_gb_huge_pages(char *param, char *val)
 }
 
 
-static int handle_mem_options(void)
+static void handle_mem_options(void)
 {
 	char *args = (char *)get_cmd_line_ptr();
 	size_t len = strlen((char *)args);
@@ -254,7 +254,7 @@ static int handle_mem_options(void)
 
 	if (!strstr(args, "memmap=") && !strstr(args, "mem=") &&
 		!strstr(args, "hugepages"))
-		return 0;
+		return;
 
 	tmp_cmdline = malloc(len + 1);
 	if (!tmp_cmdline)
@@ -272,8 +272,7 @@ static int handle_mem_options(void)
 		/* Stop at -- */
 		if (!val && strcmp(param, "--") == 0) {
 			warn("Only '--' specified in cmdline");
-			free(tmp_cmdline);
-			return -1;
+			goto out;
 		}
 
 		if (!strcmp(param, "memmap")) {
@@ -286,16 +285,16 @@ static int handle_mem_options(void)
 			if (!strcmp(p, "nopentium"))
 				continue;
 			mem_size = memparse(p, &p);
-			if (mem_size == 0) {
-				free(tmp_cmdline);
-				return -EINVAL;
-			}
+			if (mem_size == 0)
+				goto out;
+
 			mem_limit = mem_size;
 		}
 	}
 
+out:
 	free(tmp_cmdline);
-	return 0;
+	return;
 }
 
 /*
@@ -581,7 +580,6 @@ static void process_mem_region(struct mem_vector *entry,
 			       unsigned long image_size)
 {
 	struct mem_vector region, overlap;
-	struct slot_area slot_area;
 	unsigned long start_orig, end;
 	struct mem_vector cur_entry;
 
-- 
2.17.1




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-11  6:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-07  1:57 [PATCH] x86/boot/KASLR: Change the function type to void Chao Fan
2018-09-11  6:20 ` [tip:x86/boot] x86/boot/KASLR: Remove return value from handle_mem_options() tip-bot for Chao Fan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome