Skip to content

Commit 4decaad

Browse files
zbalatonkraxel
authored andcommitted
sm501: Drop unneded variable
We don't need a separate variable to keep track if we allocated memory that needs to be freed as we can test the pointer itself. Signed-off-by: BALATON Zoltan <[email protected]> Reviewed-by: Peter Maydell <[email protected]> Message-id: ff9136c3151a15cdfa1d9b7a68acf11cffb8efa4.1592686588.git.balaton@eik.bme.hu Signed-off-by: Gerd Hoffmann <[email protected]>
1 parent 84ec3f9 commit 4decaad

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

hw/display/sm501.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,13 +796,12 @@ static void sm501_2d_operation(SM501State *s)
796796
de = db + width + height * (width + dst_pitch);
797797
if (rtl && ((db >= sb && db <= se) || (de >= sb && de <= se))) {
798798
/* regions may overlap: copy via temporary */
799-
int free_buf = 0, llb = width * (1 << format);
799+
int llb = width * (1 << format);
800800
int tmp_stride = DIV_ROUND_UP(llb, sizeof(uint32_t));
801801
uint32_t *tmp = tmp_buf;
802802

803803
if (tmp_stride * sizeof(uint32_t) * height > sizeof(tmp_buf)) {
804804
tmp = g_malloc(tmp_stride * sizeof(uint32_t) * height);
805-
free_buf = 1;
806805
}
807806
pixman_blt((uint32_t *)&s->local_mem[src_base], tmp,
808807
src_pitch * (1 << format) / sizeof(uint32_t),
@@ -813,7 +812,7 @@ static void sm501_2d_operation(SM501State *s)
813812
dst_pitch * (1 << format) / sizeof(uint32_t),
814813
8 * (1 << format), 8 * (1 << format),
815814
0, 0, dst_x, dst_y, width, height);
816-
if (free_buf) {
815+
if (tmp != tmp_buf) {
817816
g_free(tmp);
818817
}
819818
} else {

0 commit comments

Comments
 (0)