According to the i.MX 8M Plus reference manual, a GPIO pin is configured as an
output when the corresponding bit in the GDIR register is set. The function
imx_gpio_set_int_line() is intended to be a no-op if the pin is configured as an
output, returning early in such cases. However, it inverts the condition. Fix
this by returning early when the bit is set.

Fixes: f44272809779 ("i.MX: Add GPIO device")
cc: qemu-stable
Signed-off-by: Bernhard Beschow <shen...@gmail.com>
---
 hw/gpio/imx_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/gpio/imx_gpio.c b/hw/gpio/imx_gpio.c
index f23c52af26..450ece4548 100644
--- a/hw/gpio/imx_gpio.c
+++ b/hw/gpio/imx_gpio.c
@@ -72,7 +72,7 @@ static void imx_gpio_update_int(IMXGPIOState *s)
 static void imx_gpio_set_int_line(IMXGPIOState *s, int line, IMXGPIOLevel 
level)
 {
     /* if this signal isn't configured as an input signal, nothing to do */
-    if (!extract32(s->gdir, line, 1)) {
+    if (extract32(s->gdir, line, 1)) {
         return;
     }
 
-- 
2.49.0


Reply via email to