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: dma: introduce dma::CoherentBox for memory initialization Date: Sun, 22 Mar 2026 03:23:43 +1000 Message-ID: In-Reply-To: <20260320194626.36263-5-dakr@kernel.org> References: <20260320194626.36263-1-dakr@kernel.org> <20260320194626.36263-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 This is the key safety improvement. `CoherentBox` wraps `Coherent` an= d provides safe `Deref`/`DerefMut` since the DMA address hasn't been expose= d to hardware yet. **`From> for Coherent`**: The conversion at: ```rust impl From> for = Coherent { fn from(value: CoherentBox) -> Self { value.0 } } ``` This moves the inner `Coherent` out without `Drop` running on the `Coherent= Box`, which is correct since `CoherentBox` is a newtype tuple struct and th= e compiler handles the move semantics. **`init_at` bounds check**: The `init_at` method checks `i >=3D self.0.len(= )` before accessing `&raw mut self[i]`. This is correct. The `Init` closure= is run on valid, aligned memory that's zeroed. The safety comment correctl= y notes that `AsBytes + FromBytes` means partial init on error is not a pro= blem. **No way to get DMA handle from `CoherentBox`**: This is intentional and th= e whole point =E2=80=94 you can't give the address to hardware until conver= ting to `Coherent`. Good design. --- Generated by Claude Code Patch Reviewer