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: drm: Wrap ioctl dispatch in UnbindGuard Date: Thu, 04 Jun 2026 12:03:17 +1000 Message-ID: In-Reply-To: <20260603011711.2077361-5-dakr@kernel.org> References: <20260603011711.2077361-1-dakr@kernel.org> <20260603011711.2077361-5-dakr@kernel.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review ```rust + // Type-inference anchor: the closure is never= called but ties `dev`'s + // type to `$func`'s first parameter, which th= e compiler cannot infer + // through method resolution and associated-ty= pe projections alone. + #[allow(unreachable_code)] + let _ =3D || $func(dev, unreachable!(), unreac= hable!()); ``` This is a well-commented workaround for a real Rust type inference limitati= on in macro-generated code. The `unreachable!()` calls diverge so the closu= re is never actually callable, but it forces the compiler to unify `dev`'s = type with the first parameter of `$func`. The `#[allow(unreachable_code)]` = suppresses the warning. Clever and correct. ```rust + let Some(_guard) =3D dev.unbind_guard() else { + return $crate::error::code::ENODEV.to_errn= o(); + }; ``` Returns `ENODEV` if the device was unplugged. The guard is `_guard` (unused= ) since the bound device isn't passed to the handler yet =E2=80=94 that com= es in patch 5. Clean incremental approach. --- Generated by Claude Code Patch Reviewer