Commit 291ac5b1 authored by Stefan Lankes's avatar Stefan Lankes
Browse files

avoid returning a `Result`, if the function is infallible

parent 0015d822
......@@ -267,7 +267,7 @@ fn detect_from_acpi() -> Result<PhysAddr, ()> {
Ok(PhysAddr(madt_header.local_apic_address.into()))
}
fn default_apic() -> Result<PhysAddr, ()> {
fn default_apic() -> PhysAddr {
warn!("Try to use default APIC address");
let defaullt_address = PhysAddr(0xFEC0_0000);
......@@ -284,7 +284,7 @@ fn default_apic() -> Result<PhysAddr, ()> {
paging::map::<BasePageSize>(IOAPIC_ADDRESS, defaullt_address, 1, flags);
}
Ok(PhysAddr(0xFEE0_0000))
PhysAddr(0xFEE0_0000)
}
fn detect_from_uhyve() -> Result<PhysAddr, ()> {
......@@ -329,9 +329,8 @@ pub fn init() {
// Detect CPUs and APICs.
let local_apic_physical_address = detect_from_uhyve()
.or_else(|_e| detect_from_acpi())
.or_else(|_e| default_apic())
.expect("HermitCore requires an APIC system");
.or_else(|| detect_from_acpi())
.unwrap_or_else(|| default_apic());
// Initialize x2APIC or xAPIC, depending on what's available.
init_x2apic();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment