Fix a bunch of warnings

This commit is contained in:
bjorn3
2026-03-11 22:03:35 +01:00
parent 49ef369fed
commit 9795abb0ea
15 changed files with 24 additions and 37 deletions
+1 -1
View File
@@ -277,7 +277,7 @@ impl SchemeSync for Ac97 {
ctx: &CallerCtx,
) -> Result<OpenResult> {
{
let mut handles = self.handles.lock();
let handles = self.handles.lock();
let handle = handles.get(&dirfd).ok_or(Error::new(EBADF))?;
if !matches!(handle, Handle::SchemeRoot) {
return Err(Error::new(EACCES));
+1 -1
View File
@@ -999,7 +999,7 @@ impl SchemeSync for IntelHDA {
ctx: &CallerCtx,
) -> Result<OpenResult> {
{
let mut handles = self.handles.lock();
let handles = self.handles.lock();
let handle = handles.get(&dirfd).ok_or(Error::new(EBADF))?;
if !matches!(handle, Handle::SchemeRoot) {
return Err(Error::new(EACCES));
+1 -1
View File
@@ -200,7 +200,7 @@ impl SchemeSync for Sb16 {
ctx: &CallerCtx,
) -> Result<OpenResult> {
{
let mut handles = self.handles.lock();
let handles = self.handles.lock();
let handle = handles.get(&dirfd).ok_or(Error::new(EBADF))?;
if !matches!(handle, Handle::SchemeRoot) {
return Err(Error::new(EACCES));
+2 -4
View File
@@ -1,5 +1,3 @@
use core::ptr;
use super::Io;
/// MMIO using pointer instead of wrapped type
@@ -35,11 +33,11 @@ where
type Value = T;
fn read(&self) -> T {
unsafe { ptr::read_volatile(self.ptr) }
unsafe { core::ptr::read_volatile(self.ptr) }
}
fn write(&mut self, value: T) {
unsafe { ptr::write_volatile(self.ptr, value) };
unsafe { core::ptr::write_volatile(self.ptr, value) };
}
}
+7 -11
View File
@@ -278,14 +278,12 @@ pub fn acquire_port_io_rights() -> Result<()> {
fn redox_cur_thrfd_v0() -> usize;
}
let kernel_fd = syscall::dup(unsafe { redox_cur_thrfd_v0() }, b"open_via_dup")?;
let res = unsafe {
libredox::call::call_wo(
kernel_fd,
&[],
syscall::CallFlags::empty(),
&[ProcSchemeVerb::Iopl as u64],
)
};
let res = libredox::call::call_wo(
kernel_fd,
&[],
syscall::CallFlags::empty(),
&[ProcSchemeVerb::Iopl as u64],
);
let _ = syscall::close(kernel_fd);
res?;
Ok(())
@@ -310,9 +308,7 @@ impl VirtaddrTranslationHandle {
/// Translate physical => virtual.
pub fn translate(&self, physical: usize) -> Result<usize> {
let mut buf = physical.to_ne_bytes();
unsafe {
libredox::call::call_ro(self.fd.raw(), &mut buf, syscall::CallFlags::empty(), &[])?;
}
libredox::call::call_ro(self.fd.raw(), &mut buf, syscall::CallFlags::empty(), &[])?;
Ok(usize::from_ne_bytes(buf))
}
}
+1 -1
View File
@@ -175,7 +175,7 @@ impl Bios {
//TODO: read VBT from mailbox 3 RVDA (0x3BA) and RVDS (0x3C2) if missing in mailbox 4
let vbt_addr = region.virt + 1024;
let mut vbt_header = unsafe { &*(vbt_addr as *const VbtHeader) };
let vbt_header = unsafe { &*(vbt_addr as *const VbtHeader) };
vbt_header.dump();
//TODO: check vbt checksum
+1 -1
View File
@@ -249,7 +249,7 @@ impl Ps2 {
warn!("keyboard incorrect result of set command: {command:?} {res:02X}");
return Ok(res);
}
x.write(data);
x.write(data)?;
x.read()
},
)
+1 -1
View File
@@ -1,5 +1,5 @@
use inputd::ProducerHandle;
use log::{error, info, warn};
use log::{error, warn};
use orbclient::{ButtonEvent, KeyEvent, MouseEvent, MouseRelativeEvent, ScrollEvent};
use std::{
convert::TryInto,
+1 -3
View File
@@ -290,7 +290,7 @@ fn main() -> Result<()> {
loop {
//TODO: get frequency from device
//TODO: use sleeps when accuracy is better: thread::sleep(time::Duration::from_millis(10));
let mut timer = time::Instant::now();
let timer = time::Instant::now();
while timer.elapsed() < time::Duration::from_millis(1) {
thread::yield_now();
}
@@ -454,6 +454,4 @@ fn main() -> Result<()> {
// log::trace!("took {}ms", timer.elapsed().as_millis())
}
Ok(())
}
+1 -2
View File
@@ -396,8 +396,7 @@ impl Display for KeymapKind {
KeymapKind::Bepo => "bepo",
KeymapKind::IT => "it",
};
f.write_str(s);
Ok(())
f.write_str(s)
}
}
+1 -1
View File
@@ -193,7 +193,7 @@ impl Rtl8168 {
mac_address: [0; 6],
};
module.init();
module.init()?;
Ok(module)
}
+2 -3
View File
@@ -16,8 +16,8 @@ use redox_scheme::{CallerCtx, OpenResult, RequestKind, Response, SignalBehavior,
use syscall::dirent::DirentBuf;
use syscall::schemev2::NewFdFlags;
use syscall::{
CallFlags, Error, Result, Stat, EACCES, EAGAIN, EBADF, EINTR, EINVAL, EISDIR, ENOENT, ENOLCK,
EOPNOTSUPP, EOVERFLOW, EWOULDBLOCK, MODE_DIR, MODE_FILE, O_DIRECTORY, O_STAT,
Error, Result, Stat, EACCES, EAGAIN, EBADF, EINTR, EINVAL, EISDIR, ENOENT, ENOLCK, EOPNOTSUPP,
EOVERFLOW, EWOULDBLOCK, MODE_DIR, MODE_FILE, O_DIRECTORY, O_STAT,
};
/// Split the read operation into a series of block reads.
@@ -339,7 +339,6 @@ impl<T: Disk> DiskScheme<T> {
self.inner.on_close(id);
continue;
}
RequestKind::RecvFd(_) => continue,
RequestKind::OnDetach { .. } => continue,
};
self.inner
+3 -3
View File
@@ -551,12 +551,12 @@ impl XhciClientHandle {
Ok(String::from_utf8(buf)?)
}
pub fn attach(&self) -> result::Result<(), XhciClientHandleError> {
let mut file = self.fd.openat("attach", libredox::flag::O_WRONLY, 0)?;
let file = self.fd.openat("attach", libredox::flag::O_WRONLY, 0)?;
let _bytes_written = file.write(&[])?;
Ok(())
}
pub fn detach(&self) -> result::Result<(), XhciClientHandleError> {
let mut file = self.fd.openat("detach", libredox::flag::O_WRONLY, 0)?;
let file = self.fd.openat("detach", libredox::flag::O_WRONLY, 0)?;
let _bytes_written = file.write(&[])?;
Ok(())
}
@@ -569,7 +569,7 @@ impl XhciClientHandle {
req: &ConfigureEndpointsReq,
) -> result::Result<(), XhciClientHandleError> {
let json = serde_json::to_vec(req)?;
let mut file = self.fd.openat("configure", libredox::flag::O_WRONLY, 0)?;
let file = self.fd.openat("configure", libredox::flag::O_WRONLY, 0)?;
let json_bytes_written = file.write(&json)?;
if json_bytes_written != json.len() {
return Err(XhciClientHandleError::InvalidResponse(Invalid(
+1 -1
View File
@@ -65,7 +65,7 @@ pub fn spawn_irq_thread(irq_handle: &File, queue: &Arc<Queue<'static>>) {
.subscribe(irq_fd as usize, 0, event::EventFlags::READ)
.unwrap();
for event in event_queue.map(Result::unwrap) {
for _ in event_queue.map(Result::unwrap) {
// Wake up the tasks waiting on the queue.
for (_, task) in queue_copy.waker.lock().unwrap().iter() {
task.wake_by_ref();
-3
View File
@@ -30,9 +30,6 @@ enum Handle {
SchemeRoot,
}
// TODO: Move to relibc
const AT_REMOVEDIR: usize = 0x200;
pub struct Scheme {
scheme_name: String,
filesystem: Filesystem,