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: add Coherent:init() and Coherent::init_with_attrs() Date: Sun, 22 Mar 2026 03:23:43 +1000 Message-ID: In-Reply-To: <20260320194626.36263-6-dakr@kernel.org> References: <20260320194626.36263-1-dakr@kernel.org> <20260320194626.36263-6-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 Adds one-shot constructors that allocate uninitialized DMA memory, run an `= Init` closure, and return the `Coherent` directly. **Commit message refers to "CoherentInit"**: The message says "Compared to = CoherentInit, Coherent::init() is a one-shot constructor" =E2=80=94 but the= type was renamed to `CoherentBox` in this v2 series (per the cover letter)= . The commit message should reference `CoherentBox` instead. **Safety of init on uninitialized memory**: The `alloc_with_attrs` (without= `__GFP_ZERO`) is used, so the memory is uninitialized. The safety comment = says: ```rust // - If `__init` fails, `self` is dropped, which safely frees the underlyin= g `Coherent`'s // DMA memory. `T: AsBytes + FromBytes` ensures there are no complex `Dro= p` requirements // we are bypassing. ``` This is correct =E2=80=94 `AsBytes + FromBytes` types have no drop glue tha= t could observe uninitialized memory. However, if `__init` fails, the `Cohe= rent` in `dmem` is dropped, calling `dma_free_attrs` on memory that was nev= er initialized. This is fine since the DMA deallocation only cares about th= e address/size, not the content. --- Generated by Claude Code Patch Reviewer