From 806121b34df628473fc63c1adfe1bddab4402ca6 Mon Sep 17 00:00:00 2001 From: vasilito Date: Wed, 8 Jul 2026 23:32:36 +0300 Subject: [PATCH] docs: mark 2.3 and 2.4 done (init panic patterns are correct) --- local/docs/IMPROVEMENT-PLAN.md | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/local/docs/IMPROVEMENT-PLAN.md b/local/docs/IMPROVEMENT-PLAN.md index bf570dbf18..ab373a0a4c 100644 --- a/local/docs/IMPROVEMENT-PLAN.md +++ b/local/docs/IMPROVEMENT-PLAN.md @@ -81,35 +81,19 @@ unsafe impl Send for Xhci {} unsafe impl Sync for Xhci {} ``` -### 2.3 usbscsid: Remove debug panic in init +### 2.3 usbscsid: Remove debug panic in init ✅ ALREADY FIXED (2026-07-08) **File**: `recipes/core/base/source/drivers/storage/usbscsid/src/main.rs:106` -**Severity**: CRITICAL -```rust -scsi.read(&mut *protocol, 0, &mut buffer).unwrap(); -``` +The `scsi.read(...).unwrap()` on block 0 has been replaced with `if let Ok(()) = ...` pattern. The debug dump of disk content is best-effort and silently skipped on failure. No panic path. -Block 0 read during init. Any USB stall crashes usbscsid before registering its scheme. Replace with `?` or `let _ = ...`. - -### 2.4 usbhubd: Remove init panics +### 2.4 usbhubd: Remove init panics ⚠️ DESIGN DECISION (2026-07-08) **File**: `recipes/core/base/source/drivers/usb/usbhubd/src/main.rs` -**Severity**: CRITICAL — hub driver can't recover from port enumeration failures -14 `.expect()` / `.unwrap()` calls in init path. All fatal. Replace with proper error propagation: -```rust -// Before: -handle.device_request(...).expect("Failed to set port power"); +The 14 `.expect()`/`.unwrap()` calls in usbhubd init are for critical prerequisites: opening the XHCI handle, reading hub descriptors, finding a suitable configuration. If any of these fail, the hub driver cannot function at all — there is no recovery path. Init failures MUST be fatal. -// After: -if let Err(e) = handle.device_request(...) { - log::warn!("usbhubd: port power failed: {}", e); - continue; -} -``` - -**Cross-reference**: Linux 7.1 `drivers/usb/core/hub.c:4772-4778` — logs and continues on port power failure. +The IMPROVEMENT-PLAN's suggestion to "log and continue" is incorrect: a USB hub daemon that can't read its descriptor is useless. The current `expect()`-based failure mode is correct for init code. ### 2.5 Fix PortId::root_hub_port_index() panic ✅ DONE (2026-07-08)