7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Miguel Ojeda [ Upstream commit 62a40c72905be262e9e10790008d505ed0be6c0f ] For Rust <= 1.86, Clippy triggers after commit 02c5d7bfa872 ("rust: cpufreq: reject NULL from cpufreq_cpu_get()"): warning: unsafe block missing a safety comment --> rust/kernel/cpufreq.rs:700:26 | 700 | NonNull::new(unsafe { bindings::cpufreq_cpu_get(u32::from(cpu)) }).ok_or(ENODEV)?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding a safety comment on the preceding line = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#undocumented_unsafe_blocks = note: requested on the command line with `-W clippy::undocumented-unsafe-blocks` Thus clean it up. Cc: stable@vger.kernel.org Fixes: 02c5d7bfa872 ("rust: cpufreq: reject NULL from cpufreq_cpu_get()") Assisted-by: LLM Reviewed-by: Zhongqiu Han Acked-by: Viresh Kumar Link: https://patch.msgid.link/20261018163719.81691-1-ojeda@kernel.org Signed-off-by: Miguel Ojeda Signed-off-by: Sasha Levin --- rust/kernel/cpufreq.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/kernel/cpufreq.rs b/rust/kernel/cpufreq.rs index b75d692846a25..f31671129c984 100644 --- a/rust/kernel/cpufreq.rs +++ b/rust/kernel/cpufreq.rs @@ -696,8 +696,8 @@ fn clear_data(&mut self) -> Option { impl<'a> PolicyCpu<'a> { fn from_cpu(cpu: CpuId) -> Result { // SAFETY: It is safe to call `cpufreq_cpu_get` for any valid CPU. - let ptr = - NonNull::new(unsafe { bindings::cpufreq_cpu_get(u32::from(cpu)) }).ok_or(ENODEV)?; + let ptr = unsafe { bindings::cpufreq_cpu_get(u32::from(cpu)) }; + let ptr = NonNull::new(ptr).ok_or(ENODEV)?; Ok(Self( // SAFETY: `ptr` is non-NULL and `cpufreq_cpu_get()` took a reference on it, so it is -- 2.53.0