From d3642a0e027b67a2f5fa7628ed349d7fdb320b50 Mon Sep 17 00:00:00 2001 From: "Thomas H.P. Andersen" Date: Sun, 26 Dec 2021 01:58:50 +0100 Subject: [PATCH] nvc0: fix a warning -Wconstant-conversion I do not understand the code here well enough to tell what the correct behavior is. prog->num_gprs is a unit8_t, so my guess is that the MIN is there to make sure we stay within the limit of that. However the current logic is a bit strange. If info_out.bin.maxGPR + 5 is bellow 256 we use that. If not then we write 256 which converts to 0 in a uint8_t... The patch changes the upper value to 255. Fixes a warning with clang Reviewed-by: Karol Herbst Part-of: --- src/gallium/drivers/nouveau/nvc0/nvc0_program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c index 36d0f7017c7..38082b8e203 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c @@ -686,7 +686,7 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset, prog->relocs = info_out.bin.relocData; prog->fixups = info_out.bin.fixupData; if (info_out.target >= NVISA_GV100_CHIPSET) - prog->num_gprs = MIN2(info_out.bin.maxGPR + 5, 256); //XXX: why? + prog->num_gprs = MIN2(info_out.bin.maxGPR + 5, 255); //XXX: why? else prog->num_gprs = MAX2(4, (info_out.bin.maxGPR + 1)); prog->cp.smem_size = info_out.bin.smemSize;