From e5fda871fd98d0c1dbecd276ba9a75a5fd1a974d Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 6 Aug 2025 13:13:56 +0200 Subject: [PATCH] panvk: avoid implicit cast-warning on Clang BITFIELD_MASK() returns a 32-bit unsigned integer, and Clang complains if we assign it to a 16-bit unsigned integer without a cast. Let's add that cast. While we're at it, add an assert() to make it clear to the compiler that the condition in BITFIELD_MASK() can be optimized away. Reviewed-by: Yiwei Zhang Tested-by: Yiwei Zhang Reviewed-by: Eric R. Smith Part-of: --- src/panfrost/vulkan/panvk_vX_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/panfrost/vulkan/panvk_vX_device.c b/src/panfrost/vulkan/panvk_vX_device.c index 6113567e32b..0e7eb5fc3b9 100644 --- a/src/panfrost/vulkan/panvk_vX_device.c +++ b/src/panfrost/vulkan/panvk_vX_device.c @@ -385,9 +385,9 @@ panvk_per_arch(create_device)(struct panvk_physical_device *physical_device, const struct drm_panthor_csif_info *csif_info = panthor_kmod_get_csif_props(device->kmod.dev); - assert(csif_info->scoreboard_slot_count < UINT8_MAX); + assert(csif_info->scoreboard_slot_count <= 16); device->csf.sb.count = csif_info->scoreboard_slot_count; - device->csf.sb.all_mask = BITFIELD_MASK(device->csf.sb.count); + device->csf.sb.all_mask = (uint16_t)BITFIELD_MASK(csif_info->scoreboard_slot_count); assert(device->csf.sb.count > PANVK_SB_ITER_START); device->csf.sb.iter_count = device->csf.sb.count - PANVK_SB_ITER_START;