Commit 2c6bd950 authored by Thomas Andersen's avatar Thomas Andersen
Browse files

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
parent 222487fa
Pipeline #472278 waiting for manual action with stages
in 10 seconds
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment