imx: imx8qm/qxp: Fix issue in get_effective_memsize
[oweals/u-boot.git] / drivers / video / da8xx-fb.c
index 6ec4f89e346d357892b31492e72645670a55004b..5fb68865ef4631adffba5be54598ed35ef6d2360 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Porting to u-boot:
  *
  *
  * Based on the LCD driver for TI Avalanche processors written by
  * Ajay Singh and Shalom Hai.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <malloc.h>
 #include <memalign.h>
 #include <video_fb.h>
 #include <linux/list.h>
@@ -853,9 +853,10 @@ static u32 wait_for_event(u32 event)
        do {
                ret = lcdc_irq_handler();
                udelay(1000);
-       } while (!(ret & event));
+               --timeout;
+       } while (!(ret & event) && timeout);
 
-       if (timeout <= 0) {
+       if (!(ret & event)) {
                printf("%s: event %d not hit\n", __func__, event);
                return -1;
        }