summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-01 09:57:51 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-01 14:01:21 +0000
commit021b55735bdb9b2bffb829be4ebcad3965b8fa78 (patch)
tree6dd24f8189294d987bf0ab2fe1020a654fa7097f /firmware
parent0a7b23097ad033fb6f27fbbfd69e351c6acddef2 (diff)
downloadrockbox-021b55735bdb9b2bffb829be4ebcad3965b8fa78.tar.gz
rockbox-021b55735bdb9b2bffb829be4ebcad3965b8fa78.zip
hosted: fix shutdown crash in framebuffer code.
Change-Id: I78315b81ab8df0408abc64d5edb6af37db568ad7
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/hosted/lcd-linuxfb.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/firmware/target/hosted/lcd-linuxfb.c b/firmware/target/hosted/lcd-linuxfb.c
index 3d7c9d99a9..6a57be9e40 100644
--- a/firmware/target/hosted/lcd-linuxfb.c
+++ b/firmware/target/hosted/lcd-linuxfb.c
@@ -37,7 +37,7 @@
37static int fd = -1; 37static int fd = -1;
38static struct fb_var_screeninfo vinfo; 38static struct fb_var_screeninfo vinfo;
39static struct fb_fix_screeninfo finfo; 39static struct fb_fix_screeninfo finfo;
40fb_data *framebuffer = 0; /* global variable, see lcd-target.h */ 40fb_data *framebuffer = NULL; /* global variable, see lcd-target.h */
41 41
42static void redraw(void) 42static void redraw(void)
43{ 43{
@@ -93,13 +93,17 @@ void lcd_init_device(void)
93void lcd_shutdown(void) 93void lcd_shutdown(void)
94{ 94{
95 munmap(framebuffer, FRAMEBUFFER_SIZE); 95 munmap(framebuffer, FRAMEBUFFER_SIZE);
96 framebuffer = NULL;
96 close(fd); 97 close(fd);
98 fd = -1;
97} 99}
98#endif 100#endif
99 101
100#ifdef HAVE_LCD_ENABLE 102#ifdef HAVE_LCD_ENABLE
101void lcd_enable(bool on) 103void lcd_enable(bool on)
102{ 104{
105 if (fd < 0) return;
106
103 lcd_set_active(on); 107 lcd_set_active(on);
104 if (on) 108 if (on)
105 { 109 {
@@ -120,6 +124,8 @@ extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src,
120 124
121void lcd_update(void) 125void lcd_update(void)
122{ 126{
127 if (fd < 0) return;
128
123#ifdef HAVE_LCD_ENABLE 129#ifdef HAVE_LCD_ENABLE
124 if (lcd_active()) 130 if (lcd_active())
125#endif 131#endif
@@ -133,6 +139,8 @@ void lcd_update(void)
133 139
134void lcd_update_rect(int x, int y, int width, int height) 140void lcd_update_rect(int x, int y, int width, int height)
135{ 141{
142 if (fd < 0) return;
143
136#ifdef HAVE_LCD_ENABLE 144#ifdef HAVE_LCD_ENABLE
137 if (lcd_active()) 145 if (lcd_active())
138#endif 146#endif