Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: cpufreq: replace `MaybeUninit::zeroed().assume_init()` with `pin_init::zeroed()`

All types in `bindings` implement `Zeroable` if they can, so use
`pin_init::zeroed` instead of relying on `unsafe` code.

If this ends up not compiling in the future, something in bindgen or on
the C side changed and is most likely incorrect.

Signed-off-by: Benno Lossin <lossin@kernel.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Benno Lossin and committed by
Miguel Ojeda
4fa9f72d 4846300b

+1 -3
+1 -3
rust/kernel/cpufreq.rs
··· 27 27 use core::{ 28 28 cell::UnsafeCell, 29 29 marker::PhantomData, 30 - mem::MaybeUninit, 31 30 ops::{Deref, DerefMut}, 32 31 pin::Pin, 33 32 ptr, ··· 1012 1013 } else { 1013 1014 None 1014 1015 }, 1015 - // SAFETY: All zeros is a valid value for `bindings::cpufreq_driver`. 1016 - ..unsafe { MaybeUninit::zeroed().assume_init() } 1016 + ..pin_init::zeroed() 1017 1017 }; 1018 1018 1019 1019 const fn copy_name(name: &'static CStr) -> [c_char; CPUFREQ_NAME_LEN] {