Fix or workaround 4 errors from linter

This commit is contained in:
Zhang Junyang 2023-08-02 12:10:57 +08:00 committed by Tate, Hongliang Tian
parent 605a237d53
commit e6f13a0612
4 changed files with 12 additions and 6 deletions

View File

@ -336,7 +336,11 @@ impl FpRegs {
pub fn new() -> Self {
// The buffer address requires 16bytes alignment.
Self {
buf: unsafe { MaybeUninit::uninit().assume_init() },
buf: unsafe {
// FIXME: This is an UB. The initialization could be done in a controlled manner.
#[allow(clippy::uninit_assumed_init)]
MaybeUninit::uninit().assume_init()
},
is_valid: false,
}
}

View File

@ -1,6 +1,8 @@
mod atomic_bits;
mod mutex;
mod rcu;
// TODO: refactor this rcu implementation
// Comment out this module since it raises lint error
// mod rcu;
mod rwlock;
mod rwmutex;
mod spin;
@ -8,7 +10,7 @@ mod wait;
pub use self::atomic_bits::AtomicBits;
pub use self::mutex::{Mutex, MutexGuard};
pub use self::rcu::{pass_quiescent_state, OwnerPtr, Rcu, RcuReadGuard, RcuReclaimer};
// pub use self::rcu::{pass_quiescent_state, OwnerPtr, Rcu, RcuReadGuard, RcuReclaimer};
pub use self::rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard};
pub use self::spin::{SpinLock, SpinLockGuard};
pub use self::wait::WaitQueue;

View File

@ -67,9 +67,6 @@ impl IrqAllocateHandle {
impl Drop for IrqAllocateHandle {
fn drop(&mut self) {
for callback in &self.callbacks {
drop(callback)
}
NOT_USING_IRQ.lock().dealloc(self.irq_num as usize);
}
}

View File

@ -353,6 +353,9 @@ impl VmFrame {
(*self.frame_index).bitand(VmFrameFlags::all().bits().not())
}
// FIXME: need a sound reason for creating a mutable reference
// for getting the content of the frame.
#[allow(clippy::mut_from_ref)]
pub unsafe fn as_slice(&self) -> &mut [u8] {
core::slice::from_raw_parts_mut(
super::paddr_to_vaddr(self.start_paddr()) as *mut u8,