video, da8xx-fb: fix time out in wait_for_event()
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 18 Mar 2018 13:48:06 +0000 (14:48 +0100)
committerAnatolij Gustschin <agust@denx.de>
Mon, 19 Mar 2018 08:49:20 +0000 (09:49 +0100)
If an event does not occur the current coding stays in an endless loop.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
drivers/video/da8xx-fb.c

index 6ec4f89e346d357892b31492e72645670a55004b..26db73b13883e51742f4f1a547bab62e2383288c 100644 (file)
@@ -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;
        }