rust: kernel: module_param: replace pr_warn with pr_warn_once
Subsystems (2)
PATCH 1/1 rust: kernel: module_param: replace pr_warn with pr_warn_once
Replace pr_warn!() with pr_warn_once!() in module_param::set_param() to avoid flooding the kernel log when a null pointer is repeatedly passed.
The original code had a TODO comment noting that pr_warn_once should be used once available. Since pr_warn_once!() is now available, switch to it and update the comment accordingly.
Signed-off-by Xiaobo Liu <[email protected]>
--- rust/kernel/module_param.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
rust/kernel/module_param.rs +2 -2
@@ -62,8 +62,8 @@ pub trait ModuleParam: Sized + Copy {// 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`" ); +// `pr_warn_once` is already available, use it. +crate ::pr_warn_once!("Null pointer passed to `module_param::set_param`" );return EINVAL .to_errno (); }
Signature · 1 line
2.34.1