powerpc64/powernv: Avoid type promotion

There is a type promotion that transform count = -1 into a unsigned int causing
the default TCE SEG SIZE not being returned on a Boston POWER9 machine.

This machine does not have the 'ibm,supported-tce-sizes' entries, thus, count
is set to -1, and the function continue to execute instead of returning.

Reviewed by: jhibbits, wma
Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D15763
This commit is contained in:
Breno Leitao 2018-06-12 19:50:33 +00:00
parent 90d2dfab19
commit 5ecc8c2077

View File

@ -221,7 +221,7 @@ max_tce_size(device_t dev)
count = OF_getencprop(node, "ibm,supported-tce-sizes",
sizes, sizeof(sizes));
if (count < sizeof(cell_t))
if (count < (int) sizeof(cell_t))
return OPAL_PCI_TCE_DEFAULT_SEG_SIZE;
count /= sizeof(cell_t);