From ac2f40107cf1296955c867dc31b1a1eceb8ec569 Mon Sep 17 00:00:00 2001 From: Andreas Hindborg Date: Mon, 27 Apr 2026 10:11:35 +0200 Subject: rust: module_param: use `pr_warn_once!` for null pointer warning Replace `pr_warn!` and the accompanying TODO with `pr_warn_once!`, now that the macro is available. [ Note: Adarsh Das independently authored an identical patch on the rust-for-linux list, but it missed the modules tree. ] Suggested-by: Adarsh Das Signed-off-by: Andreas Hindborg Reviewed-by: Aaron Tomlin Reviewed-by: Gary Guo Reviewed-by: Daniel Gomez Signed-off-by: Sami Tolvanen --- rust/kernel/module_param.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'rust/kernel') diff --git a/rust/kernel/module_param.rs b/rust/kernel/module_param.rs index 6a8a7a875643..dd6d663a0a3c 100644 --- a/rust/kernel/module_param.rs +++ b/rust/kernel/module_param.rs @@ -62,8 +62,7 @@ where // NOTE: If we start supporting arguments without values, val _is_ allowed // to be null here. if val.is_null() { - // TODO: Use pr_warn_once available. - crate::pr_warn!("Null pointer passed to `module_param::set_param`"); + crate::pr_warn_once!("Null pointer passed to `module_param::set_param`"); return EINVAL.to_errno(); } -- cgit v1.2.3 From 36d6b929bb0c7cc1cc742d9b5805537d3b651094 Mon Sep 17 00:00:00 2001 From: Kenny Glowner Date: Thu, 21 May 2026 11:14:05 -0500 Subject: rust: module_param: add missing newline to pr_warn_once Add a trailing newline ('\n') to the pr_warn_once! call in set_param to ensure the kernel ring buffer flushes the message correctly and prevents log line smearing. Signed-off-by: Kenny Glowner Suggested-by: Miguel Ojeda Link: https://github.com/Rust-for-Linux/linux/issues/1139 [Sami: Updated the commit message as we use pr_warn_once now.] Signed-off-by: Sami Tolvanen --- rust/kernel/module_param.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rust/kernel') diff --git a/rust/kernel/module_param.rs b/rust/kernel/module_param.rs index dd6d663a0a3c..6541af218390 100644 --- a/rust/kernel/module_param.rs +++ b/rust/kernel/module_param.rs @@ -62,7 +62,7 @@ where // NOTE: If we start supporting arguments without values, val _is_ allowed // to be null here. if val.is_null() { - crate::pr_warn_once!("Null pointer passed to `module_param::set_param`"); + crate::pr_warn_once!("Null pointer passed to `module_param::set_param`\n"); return EINVAL.to_errno(); } -- cgit v1.2.3