From 71c1e7443476ce2f466f209abda0ee28c64e38c6 Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Sun, 10 Apr 2016 23:17:06 +0000 Subject: [PATCH] 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 --- sys/dev/gpio/gpioiic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/gpio/gpioiic.c b/sys/dev/gpio/gpioiic.c index 15f8f180c31..d365eea1c66 100644 --- a/sys/dev/gpio/gpioiic.c +++ b/sys/dev/gpio/gpioiic.c @@ -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) {