The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 1/3] init: Drop redundant initialization in xbc_make_cmdline()
@ 2026-12-04 22:15 Thorsten Blum
  2026-12-04 22:15 ` [PATCH 2/3] init: Use bool for done flag in parse_early_param() Thorsten Blum
  2026-12-04 22:15 ` [PATCH 3/3] init: Mark initcall_level_names as __initconst Thorsten Blum
  0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-12-04 22:15 UTC (permalink / raw)
  To: Andrew Morton, Masami Hiramatsu (Google), Thorsten Blum,
	Breno Leitao, Sang-Heon Jeon, Mike Rapoport (Microsoft),
	Wilson Felipe Pereira
  Cc: Christian Brauner, Ryan Roberts, linux-kernel

The local variable len is reassigned before its initial value is read.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 init/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init/main.c b/init/main.c
index f14780345051..c1e5daa8b52e 100644
--- a/init/main.c
+++ b/init/main.c
@@ -405,7 +405,7 @@ static char * __init xbc_make_cmdline(const char *key, bool is_kernel)
 	xbc_cmdline_filter_fn filter = is_kernel ? xbc_kernel_param_filter : NULL;
 	struct xbc_node *root;
 	char *new_cmdline;
-	int ret, len = 0;
+	int ret, len;
 
 	root = xbc_find_node(key);
 	if (!root)

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

* [PATCH 2/3] init: Use bool for done flag in parse_early_param()
  2026-12-04 22:15 [PATCH 1/3] init: Drop redundant initialization in xbc_make_cmdline() Thorsten Blum
@ 2026-12-04 22:15 ` Thorsten Blum
  2026-12-04 22:15 ` [PATCH 3/3] init: Mark initcall_level_names as __initconst Thorsten Blum
  1 sibling, 0 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-12-04 22:15 UTC (permalink / raw)
  To: Andrew Morton, Masami Hiramatsu (Google), Thorsten Blum,
	Breno Leitao, Mike Rapoport (Microsoft), Ryan Roberts,
	Wilson Felipe Pereira
  Cc: Sang-Heon Jeon, Christian Brauner, linux-kernel

The local variable done only stores a boolean value, so make it bool.

Also omit the explicit size argument to strscpy(), which uses the size
of the destination array.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 init/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/init/main.c b/init/main.c
index c1e5daa8b52e..62d37017e455 100644
--- a/init/main.c
+++ b/init/main.c
@@ -827,16 +827,16 @@ void __init parse_early_options(char *cmdline)
 /* Arch code calls this early on, or if not, just before other parsing. */
 void __init parse_early_param(void)
 {
-	static int done __initdata;
+	static bool done __initdata;
 	static char tmp_cmdline[COMMAND_LINE_SIZE] __initdata;
 
 	if (done)
 		return;
 
 	/* All fall through to do_early_param. */
-	strscpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
+	strscpy(tmp_cmdline, boot_command_line);
 	parse_early_options(tmp_cmdline);
-	done = 1;
+	done = true;
 }
 
 void __init __weak arch_post_acpi_subsys_init(void) { }

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

* [PATCH 3/3] init: Mark initcall_level_names as __initconst
  2026-12-04 22:15 [PATCH 1/3] init: Drop redundant initialization in xbc_make_cmdline() Thorsten Blum
  2026-12-04 22:15 ` [PATCH 2/3] init: Use bool for done flag in parse_early_param() Thorsten Blum
@ 2026-12-04 22:15 ` Thorsten Blum
  1 sibling, 0 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-12-04 22:15 UTC (permalink / raw)
  To: Andrew Morton, Masami Hiramatsu (Google), Thorsten Blum,
	Breno Leitao, Mike Rapoport (Microsoft), Christian Brauner
  Cc: Sang-Heon Jeon, Wilson Felipe Pereira, Ryan Roberts, linux-kernel

initcall_level_names is only read by do_initcall_level() during
initialization.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 init/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init/main.c b/init/main.c
index 62d37017e455..ad9c56159685 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1462,7 +1462,7 @@ static initcall_entry_t *initcall_levels[] __initdata = {
 };
 
 /* Keep these in sync with initcalls in include/linux/init.h */
-static const char *initcall_level_names[] __initdata = {
+static const char * const initcall_level_names[] __initconst = {
 	"pure",
 	"core",
 	"postcore",

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

end of thread, other threads:[~2026-12-04 22:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 22:15 [PATCH 1/3] init: Drop redundant initialization in xbc_make_cmdline() Thorsten Blum
2026-12-04 22:15 ` [PATCH 2/3] init: Use bool for done flag in parse_early_param() Thorsten Blum
2026-12-04 22:15 ` [PATCH 3/3] init: Mark initcall_level_names as __initconst Thorsten Blum

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