From: Simon Glass <sjg@chromium.org> The compiler can deal with the complexity of deciding whether to set up this local. Move it to the top of the function. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/video_bmp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index 478b8fbe5fd..390996dbaf1 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -68,14 +68,14 @@ static u32 get_bmp_col_rgba8888(struct bmp_color_table_entry *cte) static void write_pix8(u8 *fb, uint bpix, enum video_format eformat, struct bmp_color_table_entry *palette, u8 *bmap) { + struct bmp_color_table_entry *cte = &palette[*bmap]; + if (bpix == 8) { *fb++ = *bmap; } else if (bpix == 16) { - *(u16 *)fb = get_bmp_col_16bpp(palette[*bmap]); + *(u16 *)fb = get_bmp_col_16bpp(*cte); } else { /* Only support big endian */ - struct bmp_color_table_entry *cte = &palette[*bmap]; - if (bpix == 24) { *fb++ = cte->red; *fb++ = cte->green; -- 2.43.0