Skip to contentSkip to conversation

init/main.c: refactor maxcpus()

PATCH New Namhyung Kim 1 participant 1 message Aug 15, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 init/main.c: refactor maxcpus()

get_option() requires 2nd arg to be a pointer to int but setup_max_cpus is a pointer to unsigned int. Use max_cpus instead and update setup_max_cpus only if given value is in the proper range.

---
 init/main.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
init/main.c +7 -3
index 86cbfd0..b06b8f2 100644
@@ -165,9 +165,13 @@ early_param("nr_cpus", nrcpus);
 
 static int __init maxcpus(char *str)
 {
-	get_option(&str, &setup_max_cpus);
-	if (setup_max_cpus == 0)
-		arch_disable_smp_support();
+	int max_cpus;
+
+	get_option(&str, &max_cpus);
+	if (max_cpus == 0)
+		nosmp(NULL);
+	else if (0 < max_cpus && max_cpus < NR_CPUS)
+		setup_max_cpus = max_cpus;
 
 	return 0;
 }
Signature · 1 line
1.7.0.4