docs: mark 2.3 and 2.4 done (init panic patterns are correct)

This commit is contained in:
2026-07-08 23:32:36 +03:00
parent 50a1496b8f
commit 806121b34d
+5 -21
View File
@@ -81,35 +81,19 @@ unsafe impl<const N: usize> Send for Xhci<N> {}
unsafe impl<const N: usize> Sync for Xhci<N> {}
```
### 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)