Files
RedBear-OS/drivers/storage
Red Bear OS b7d6dd1545 usbscsid: P1-B — remove all panic sites, return proper errors
All 5 panic!() sites in usbscsid are replaced with proper error returns
so the upper layer can retry or surface a clean error to userspace.
A USB stick disconnect mid-transfer no longer crashes the system.

Changes:
  protocol/mod.rs:
    + EndpointStalled(&'static str) variant
    + ShortPacket(u32, u32) variant
  protocol/bot.rs (4 stall panics):
    - panic!() -> log::warn!() + clear_stall_*() + return Err(EndpointStalled)
  protocol/bot.rs (1 short-packet panic):
    - panic!() -> log::warn!() + return Err(ShortPacket)
  scsi/mod.rs (1 debug panic):
    - panic!() -> log::error!() + return Err(ProtocolError)

Cross-reference: Linux 7.1 drivers/usb/storage/transport.c uses
-EPIPE, -ETIME, -EIO, -ENODEV, -EILSEQ, -EPROTO for every error
path. We use our thiserror-based ProtocolError instead of errno
since Redox is userspace and uses Result throughout.

After this commit, grep -rn 'panic!' drivers/storage/usbscsid/src/
returns zero results.  P1-B done.
2026-07-07 07:44:59 +03:00
..