Skip to content

refine: Remove unused error - #178

Merged
junyu0312 merged 1 commit into
mainfrom
dev
Jun 19, 2026
Merged

junyu0312 merged 1 commit into
mainfrom
dev

Conversation

@junyu0312

@junyu0312 junyu0312 commented Jun 19, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Refactor

    • Enhanced error handling in VM bootloader initialization with improved error context propagation and removal of panic-prone code paths.
    • Simplified kernel and initrd loading error handling for better reliability.
  • Bug Fixes

    • Prevented potential panics during memory operations in the boot sequence.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c6f31014-0632-4ace-b205-d0476475d67c

📥 Commits

Reviewing files that changed from the base of the PR and between fbf27de and 894e3d8.

📒 Files selected for processing (5)
  • crates/vm-bootloader/src/boot_loader.rs
  • crates/vm-bootloader/src/initrd_loader.rs
  • crates/vm-bootloader/src/kernel_loader/error.rs
  • crates/vm-bootloader/src/kernel_loader/linux/aarch64/image.rs
  • crates/vm-bootloader/src/kernel_loader/linux/x86_64/bzimage.rs

📝 Walkthrough

Walkthrough

Error handling in vm-bootloader is tightened across three areas: KernelLoaderError loses CopyCmdlineFailed and Acpi variants and gains #[from] on CopyKernelFailed; InitrdLoaderError enriches ReadFailed with a PathBuf and adds #[from] to CopyFailed; boot_loader::Error drops MemoryOverlap and reorders its variants. Call-sites in aarch64 and x86_64 loaders replace map_err/unwrap with ?.

Changes

vm-bootloader error handling cleanup

Layer / File(s) Summary
KernelLoaderError contract and call-site propagation
crates/vm-bootloader/src/kernel_loader/error.rs, crates/vm-bootloader/src/kernel_loader/linux/aarch64/image.rs, crates/vm-bootloader/src/kernel_loader/linux/x86_64/bzimage.rs
Removes AcpiError import, CopyCmdlineFailed, and Acpi variants from KernelLoaderError; adds #[from] to CopyKernelFailed; both Image::load (aarch64) and BzImage::load (x86_64) now propagate copy failures via ? instead of map_err.
InitrdLoaderError enrichment and propagation
crates/vm-bootloader/src/initrd_loader.rs
Adds PathBuf import; ReadFailed now stores the failing path and CopyFailed gains #[from] on vm_mm::error::Error; InitrdLoader::new passes the path to ReadFailed; InitrdLoader::load replaces unwrap and map_err with ?.
boot_loader::Error reordering and MemoryOverlap removal
crates/vm-bootloader/src/boot_loader.rs
Removes the MemoryOverlap variant and reorders remaining variants so KernelLoader and LoadInitrdFailed appear early and LoadDtbFailed is placed immediately before Acpi.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • junyu0312/rust-vm#142: Modifies the same boot_loader.rs Error enum, adding/changing SetupBootCpu variants, directly adjacent to the reordering done here.
  • junyu0312/rust-vm#154: Introduces a vm-vmm BootloaderError variant that wraps vm_bootloader::boot_loader::Error, which is structurally affected by the removal of MemoryOverlap here.

Poem

🐇 Hop, hop — no more overlapping fray,
MemoryOverlap was swept away!
#[from] blooms where map_err once grew,
Paths now tucked inside errors too.
The enum stands tidy, clean, and bright —
A rabbit tidied errors right! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title 'refine: Remove unused error' is vague and generic, failing to describe which specific error is being removed or why. Clarify the title to specify which error variant(s) are removed and the primary objective, e.g., 'Remove MemoryOverlap error variant from boot loader'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@junyu0312
junyu0312 merged commit cfca91f into main Jun 19, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant