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 <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36606>
This commit is contained in:
Erik Faye-Lund 2025-08-06 13:13:56 +02:00 committed by Marge Bot
parent fed682c506
commit e5fda871fd

View file

@ -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;