diff mbox

[U-Boot,3/5] lcd: Call lcd_sync() after completing the scroll

Message ID 1429449662-9782-4-git-send-email-sjg@chromium.org
State Not Applicable
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass April 19, 2015, 1:21 p.m. UTC
On sandbox, if you add a printf() to malloc() for debugging, the output will
eventually cause the screen to scroll. Since lcd_sync() calls SDL functions
which allocate memory, and this happens before we have updated
console_curr_row, U-Boot gets locked in an infinite loop.

Flip the order of the two statements to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/lcd_console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass April 22, 2015, 6:01 p.m. UTC | #1
Hi,

On 19 April 2015 at 07:21, Simon Glass <sjg@chromium.org> wrote:
> On sandbox, if you add a printf() to malloc() for debugging, the output will
> eventually cause the screen to scroll. Since lcd_sync() calls SDL functions
> which allocate memory, and this happens before we have updated
> console_curr_row, U-Boot gets locked in an infinite loop.
>
> Flip the order of the two statements to avoid this.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  common/lcd_console.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/lcd_console.c b/common/lcd_console.c
> index 8bf83b9..ab48fd6 100644
> --- a/common/lcd_console.c
> +++ b/common/lcd_console.c
> @@ -120,8 +120,8 @@ static void console_scrollup(void)
>                 *ppix++ = bg_color;
>         }
>  #endif
> -       lcd_sync();
>         console_curr_row -= rows;
> +       lcd_sync();
>  }
>
>  static inline void console_back(void)
> --
> 2.2.0.rc0.207.ga3a616c
>

This patch is obsolete now since this problem is fixed by an earlier
patch, now applied.

I am dropping it.

Regards,
Simon
diff mbox

Patch

diff --git a/common/lcd_console.c b/common/lcd_console.c
index 8bf83b9..ab48fd6 100644
--- a/common/lcd_console.c
+++ b/common/lcd_console.c
@@ -120,8 +120,8 @@  static void console_scrollup(void)
 		*ppix++ = bg_color;
 	}
 #endif
-	lcd_sync();
 	console_curr_row -= rows;
+	lcd_sync();
 }
 
 static inline void console_back(void)