Fix IIC "how" argument dereferencing on big-endian platforms

"how" argument is passed as value of int* pointer to callback
function but dereferenced as char* so only one byte taken into
into account. On little-endian systems it happens to work because
first byte is LSB that contains actual value, on big-endian it's
MSB and in this case it's always equal zero

PR:		207786
Submitted by:	chadf@triularity.org
This commit is contained in:
Oleksandr Tymoshenko 2016-04-10 23:17:06 +00:00
parent 74b8d63dcc
commit 71c1e74434

View file

@ -157,7 +157,7 @@ gpioiic_callback(device_t dev, int index, caddr_t data)
int error, how;
how = GPIOBUS_DONTWAIT;
if (data != NULL && (int)*data == IIC_WAIT)
if (data != NULL && *(int*)data == IIC_WAIT)
how = GPIOBUS_WAIT;
error = 0;
switch (index) {