dma_buf: change unsigned int and int types into size_t

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>
This commit is contained in:
Shahyan Soltani
2026-06-30 12:04:01 -04:00
committed by Christian König
parent cff9636279
commit 44d19b8a75
2 changed files with 8 additions and 6 deletions

View 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);

View 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