From 70b39d6df56e68846bb9177e241866880b911fb5 Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Date: Wed, 13 Sep 2017 11:58:00 +0300
Subject: [PATCH] compositor-fbdev: MAP_FAILED is not NULL

Fix the assumption that MAP_FAILED would be equal to NULL. It is not.
Set 'fb' explicitly to NULL on mmap failure so that comparisons to NULL
would produce the expected result.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
---
 libweston/compositor-fbdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index 281e39b97..402648d03 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -381,6 +381,7 @@ fbdev_frame_buffer_map(struct fbdev_output *output, int fd)
 	if (output->fb == MAP_FAILED) {
 		weston_log("Failed to mmap frame buffer: %s\n",
 		           strerror(errno));
+		output->fb = NULL;
 		goto out_close;
 	}
 
-- 
GitLab