]> git.hungrycats.org Git - linux/commitdiff
dma_buf: change unsigned int and int types into size_t
authorShahyan Soltani <shahyan.soltani@amd.com>
Tue, 30 Jun 2026 16:04:01 +0000 (12:04 -0400)
committerChristian König <christian.koenig@amd.com>
Thu, 2 Jul 2026 07:27:51 +0000 (09:27 +0200)
The num_fences, count, i, and j variables in dma_fence_dedup_array() and
__dma_fence_unwrap_merge() have inconsistent integer types, mixing both
unsigned int and int.

Use type size_t consistently for these instead, and update the return
type of dma_fence_dedup_array() accordingly.

Signed-off-by: Shahyan Soltani <shahyan.soltani@amd.com>
Suggested-by: Philipp Stanner <phasta@mailbox.org>
Link: https://lore.kernel.org/r/20260630160401.67544-1-shahyan.soltani@amd.com
Reviewed-by: Philipp Stanner <phasta@kernel.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
drivers/dma-buf/dma-fence-unwrap.c
include/linux/dma-fence-unwrap.h

index 53bb40e70b2778a34245409e84fb6a865de1bb6b..65e87d263c3aced204681c04004fd29a5ef767bc 100644 (file)
@@ -93,9 +93,9 @@ static int fence_cmp(const void *_a, const void *_b)
  *
  * Return: Number of unique fences remaining in the array.
  */
-int dma_fence_dedup_array(struct dma_fence **fences, int num_fences)
+size_t dma_fence_dedup_array(struct dma_fence **fences, size_t num_fences)
 {
-       int i, j;
+       size_t i, j;
 
        sort(fences, num_fences, sizeof(*fences), fence_cmp, NULL);
 
@@ -115,14 +115,14 @@ int dma_fence_dedup_array(struct dma_fence **fences, int num_fences)
 EXPORT_SYMBOL_GPL(dma_fence_dedup_array);
 
 /* Implementation for the dma_fence_merge() marco, don't use directly */
-struct dma_fence *__dma_fence_unwrap_merge(unsigned int num_fences,
+struct dma_fence *__dma_fence_unwrap_merge(size_t num_fences,
                                           struct dma_fence **fences,
                                           struct dma_fence_unwrap *iter)
 {
        struct dma_fence *tmp, *unsignaled = NULL, **array;
        struct dma_fence_array *result;
        ktime_t timestamp;
-       int i, count;
+       size_t i, count;
 
        count = 0;
        timestamp = ns_to_ktime(0);
index 62df222fe0f16df1eff075ab7d6f69c016841299..7bfacdf79de21bca4e903e756a165645e7742b2f 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef __LINUX_DMA_FENCE_UNWRAP_H
 #define __LINUX_DMA_FENCE_UNWRAP_H
 
+#include <linux/types.h>
+
 struct dma_fence;
 
 /**
@@ -48,11 +50,11 @@ struct dma_fence *dma_fence_unwrap_next(struct dma_fence_unwrap *cursor);
        for (fence = dma_fence_unwrap_first(head, cursor); fence;       \
             fence = dma_fence_unwrap_next(cursor))
 
-struct dma_fence *__dma_fence_unwrap_merge(unsigned int num_fences,
+struct dma_fence *__dma_fence_unwrap_merge(size_t num_fences,
                                           struct dma_fence **fences,
                                           struct dma_fence_unwrap *cursors);
 
-int dma_fence_dedup_array(struct dma_fence **array, int num_fences);
+size_t dma_fence_dedup_array(struct dma_fence **array, size_t num_fences);
 
 /**
  * dma_fence_unwrap_merge - unwrap and merge fences