Message ID | 20211008114518.757615-5-laurent@vivier.eu |
---|---|
State | New |
Headers | show |
Series | [PULL,01/13] macfb: handle errors that occur during realize | expand |
diff --git a/hw/display/macfb.c b/hw/display/macfb.c index b363bab8896a..39dab49026c3 100644 --- a/hw/display/macfb.c +++ b/hw/display/macfb.c @@ -303,7 +303,9 @@ static void macfb_ctrl_write(void *opaque, s->palette_current = 0; break; case DAFB_LUT: - s->color_palette[s->palette_current++] = val; + s->color_palette[s->palette_current] = val; + s->palette_current = (s->palette_current + 1) % + ARRAY_SIZE(s->color_palette); if (s->palette_current % 3) { macfb_invalidate_display(s); }