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: Thu, 04 Jun 2026 15:28:19 +1000 Message-ID: In-Reply-To: <20260530-rust_serdev-v9-2-f8b5fccb49c3@posteo.de> References: <20260530-rust_serdev-v9-0-f8b5fccb49c3@posteo.de> <20260530-rust_serdev-v9-2-f8b5fccb49c3@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 A clean sample driver demonstrating OF and ACPI device table matching, baudrate configuration from firmware properties, parity/flow control setup, and an echo-back receive callback. **Probe error handling for `set_baudrate`:** ```rust if sdev .set_baudrate( dev.fwnode() .and_then(|fwnode| fwnode.property_read(c"baudrate").optional()) .unwrap_or(115200), ) .is_err() { return Err(EINVAL); } ``` `set_baudrate` returns `Err(actual_baudrate)` when the hardware can't match the requested rate. Treating any mismatch as a hard error is fine for a sample, though real drivers may want to accept similar rates. The `if .is_err() { return Err(EINVAL) }` pattern could be simplified, but again, fine for illustration purposes. **Receive callback silently discards write errors:** ```rust fn receive<'bound>( sdev: &'bound serdev::Device, _this: Pin<&Self>, data: &[u8], ) -> usize { let _ = sdev.write_all(data, serdev::Timeout::Max); data.len() } ``` The `let _ =` discarding the `Result` is acceptable for a sample echo driver but would be a concern in production code. Worth a brief inline comment to note the intentional discard, since `let _ =` on a `Result` sometimes triggers lints. **Kconfig entry:** Clean, correctly uses `select RUST_SERIAL_DEV_BUS_ABSTRACTIONS` to pull in the dependency. --- Generated by Claude Code Patch Reviewer