From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: gpu: nova-core: gsp: simplify sequencer opcode parsing Date: Tue, 17 Feb 2026 15:48:07 +1000 Message-ID: In-Reply-To: <20260217-nova-misc-v3-3-b4e2d45eafbc@nvidia.com> References: <20260217-nova-misc-v3-0-b4e2d45eafbc@nvidia.com> <20260217-nova-misc-v3-3-b4e2d45eafbc@nvidia.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review This replaces the roundabout pattern of creating a byte slice from the union field and then parsing it via `FromBytes` with a direct read of the union field. The safety comments are preserved and correct - the opcode is checked before accessing the union, so the union field access is valid. > - let payload_bytes = unsafe { > - core::slice::from_raw_parts( > - core::ptr::addr_of!(self.0.payload.regWrite).cast::(), > - core::mem::size_of::(), > - ) > - }; > - Ok(*RegWritePayload::from_bytes(payload_bytes).ok_or(EINVAL)?) > + Ok(RegWritePayload(unsafe { self.0.payload.regWrite })) Since the payload types are `#[repr(transparent)]` wrappers around the binding types, constructing them directly from the union field is sound. The `from_bytes` call could never fail anyway (the types implement `FromBytes`), so removing it doesn't change behavior - it just removes unnecessary indirection. The same pattern is repeated for all five payload types. No issues found. --- Generated by Claude Code Patch Reviewer