From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: rust: devres: return reference in `devres::register` Date: Tue, 28 Apr 2026 14:14:44 +1000 Message-ID: In-Reply-To: <20260427-rust_serdev-v6-1-173798d5e1a3@posteo.de> References: <20260427-rust_serdev-v6-0-173798d5e1a3@posteo.de> <20260427-rust_serdev-v6-1-173798d5e1a3@posteo.de> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review This patch changes `devres::register` from returning `Result` to `Result<&'= a T>`, tying the lifetime of the returned reference to the `&'a Device` argument. **The lifetime reasoning is sound.** As long as you hold `&Device`, = the device is bound and devres-managed data won't be freed, so the pointer = remains valid for `'a`. The raw pointer capture before the move is the right approach: ```rust let data_ptr =3D &raw const *data; register_foreign(dev, data) .map(|()| unsafe { &*data_ptr }) ``` **Callers updated correctly.** Both `cpufreq.rs` and `drm/driver.rs` now us= e `?;` + `Ok(())` since they don't need the returned reference =E2=80=94 th= ey just discard it. This is a clean, backward-compatible change. No issues with this patch. --- --- Generated by Claude Code Patch Reviewer