From: Huang Rui Date: Tue, 7 Sep 2021 10:03:02 +0000 (+0800) Subject: drm/ttm: fix the type mismatch error on sparc64 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=282abb5a1f381d0ec10b20893961563be174a1c3;p=linux.git drm/ttm: fix the type mismatch error on sparc64 __fls() on sparc64 return "int", but here it is expected as "unsigned long" (x86). It will cause the build errors because the warning becomes fatal while it is using sparc configuration. As suggested by Linus, it can use min_t instead of min to force the type as "unsigned int". Suggested-by: Linus Torvalds Signed-off-by: Huang Rui Cc: Christian König Reviewed-by: Christian König Signed-off-by: Christian König Link: https://patchwork.freedesktop.org/patch/msgid/20210907100302.3684453-1-ray.huang@amd.com --- diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c index af1b413696261..c961a788b519f 100644 --- a/drivers/gpu/drm/ttm/ttm_pool.c +++ b/drivers/gpu/drm/ttm/ttm_pool.c @@ -382,7 +382,8 @@ int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt, else gfp_flags |= GFP_HIGHUSER; - for (order = min(MAX_ORDER - 1UL, __fls(num_pages)); num_pages; + for (order = min_t(unsigned int, MAX_ORDER - 1, __fls(num_pages)); + num_pages; order = min_t(unsigned int, order, __fls(num_pages))) { bool apply_caching = false; struct ttm_pool_type *pt;