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: host1x: Fix iommu_map_sgtable() return value check Date: Thu, 23 Apr 2026 08:57:23 +1000 Message-ID: In-Reply-To: <20260421-iommu_map_sgtable-return-v1-1-fb484c07d2a1@nvidia.com> References: <20260421-iommu_map_sgtable-return-v1-0-fb484c07d2a1@nvidia.com> <20260421-iommu_map_sgtable-return-v1-1-fb484c07d2a1@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 **Status: Good** The old code assigned `iommu_map_sgtable()` directly into `int err`, which has two problems: (1) it checked `== 0` for failure (inverted vs the new API), and (2) assigning `ssize_t` into `int` could truncate large success values into negative numbers, creating false failures. The commit message correctly identifies both issues. The fix introduces a properly-typed `ssize_t map_err` local, checks `< 0`, and propagates the actual error instead of a hardcoded `-EINVAL`: ```c + ssize_t map_err; ... + map_err = iommu_map_sgtable(host->domain, iova_dma_addr(&host->iova, alloc), + map->sgt, IOMMU_READ); + if (map_err < 0) { __free_iova(&host->iova, alloc); - err = -EINVAL; + err = map_err; ``` The `err = map_err` assignment narrows `ssize_t` to `int`, but this is fine on the error path since negative errnos always fit in an `int`. No issues. --- Generated by Claude Code Patch Reviewer