From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: dma-buf: heaps: use designated initializer for exp_info Date: Wed, 11 Feb 2026 16:59:18 +1000 Message-ID: In-Reply-To: <20260209153809.250835-4-jiri@resnulli.us> References: <20260209153809.250835-1-jiri@resnulli.us> <20260209153809.250835-4-jiri@resnulli.us> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Mailer: Claude Code Patch Reviewer Patch Review **Subject**: `dma-buf: heaps: use designated initializer for exp_info` **Files Modified**: `drivers/dma-buf/heaps/cma_heap.c`, `drivers/dma-buf/heaps/system_heap.c` **Verdict**: ✅ **Good cleanup** (pure refactoring) #### Technical Review Pure refactoring patch to use C99 designated initializers instead of field-by-field assignment. **Changes in cma_heap.c** (lines 585-598): ```c - struct dma_heap_export_info exp_info; + struct dma_heap_export_info exp_info = { + .name = name, + .ops = &cma_heap_ops, + }; ... - exp_info.name = name; - exp_info.ops = &cma_heap_ops; exp_info.priv = cma_heap; ``` **Analysis**: ✅ Modern C style ✅ Zero-initializes all unspecified fields automatically ✅ Makes follow-up patches cleaner (PATCH 4 adds new field) ✅ No functional change ✅ Reduces lines of code **Question**: Why is `exp_info.priv = cma_heap;` kept as separate assignment instead of being in the initializer? Answer: Because `cma_heap` is allocated just before (line 591-593), so it's not available at initialization time. This is fine. **Correctness Check**: - Before: `exp_info` on stack, uninitialized, then `.name` and `.ops` assigned - After: `exp_info` on stack, zero-initialized, with `.name` and `.ops` set - Both: `.priv` assigned later This is semantically identical. ✅ --- --- Generated by Claude Code Patch Reviewer