summaryrefslogtreecommitdiffstats
path: root/firmware/target/hosted/lcd-linuxfb.c
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/target/hosted/lcd-linuxfb.c
parent0a7b23097ad033fb6f27fbbfd69e351c6acddef2 (diff)
downloadrockbox-021b55735b.tar.gz
rockbox-021b55735b.tar.bz2
rockbox-021b55735b.zip
hosted: fix shutdown crash in framebuffer code.
Change-Id: I78315b81ab8df0408abc64d5edb6af37db568ad7
Diffstat (limited to 'firmware/target/hosted/lcd-linuxfb.c')
-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 @@
static int fd = -1;
static struct fb_var_screeninfo vinfo;
static struct fb_fix_screeninfo finfo;
-fb_data *framebuffer = 0; /* global variable, see lcd-target.h */
+fb_data *framebuffer = NULL; /* global variable, see lcd-target.h */
static void redraw(void)
{
@@ -93,13 +93,17 @@ void lcd_init_device(void)
void lcd_shutdown(void)
{
munmap(framebuffer, FRAMEBUFFER_SIZE);
+ framebuffer = NULL;
close(fd);
+ fd = -1;
}
#endif
#ifdef HAVE_LCD_ENABLE
void lcd_enable(bool on)
{
+ if (fd < 0) return;
+
lcd_set_active(on);
if (on)
{
@@ -120,6 +124,8 @@ extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src,
void lcd_update(void)
{
+ if (fd < 0) return;
+
#ifdef HAVE_LCD_ENABLE
if (lcd_active())
#endif
@@ -133,6 +139,8 @@ void lcd_update(void)
void lcd_update_rect(int x, int y, int width, int height)
{
+ if (fd < 0) return;
+
#ifdef HAVE_LCD_ENABLE
if (lcd_active())
#endif