From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: samples: rust: add Rust serial device bus sample device driver Date: Mon, 09 Mar 2026 08:21:40 +1000 Message-ID: In-Reply-To: <20260306-rust_serdev-v2-4-e9b23b42b255@posteo.de> References: <20260306-rust_serdev-v2-0-e9b23b42b255@posteo.de> <20260306-rust_serdev-v2-4-e9b23b42b255@posteo.de> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review The sample is clean and demonstrates the abstraction well. A few notes: **`set_baudrate` error handling is odd due to the API design:** ```rust if sdev .set_baudrate( dev.fwnode() .and_then(|fwnode| fwnode.property_read(c"baudrate").optional()) .unwrap_or(115200), ) .is_err() { return Err(EINVAL); } ``` This discards the actual baudrate returned in the error. If `set_baudrate` returned `u32` instead of `Result<(), u32>`, this would be simpler and more informative. **Echo server with `Timeout::Max` would hang:** Due to the `Timeout::Max` bug (returning 0), `write_all` in receive would return immediately or with ETIMEDOUT rather than actually waiting. This makes the sample non-functional in practice. **The sample stores an `ARef` but never uses it** (except in Drop for a debug message). This is fine for a sample but worth noting. --- Generated by Claude Code Patch Reviewer