e2eb78
From a976b037b63d8de9ed0eb920238ac4211b649408 Mon Sep 17 00:00:00 2001
e2eb78
From: Wim Taymans <wtaymans@redhat.com>
e2eb78
Date: Mon, 29 Apr 2019 15:50:39 +0200
e2eb78
Subject: [PATCH] fix small errors detected by coverity
e2eb78
e2eb78
---
e2eb78
 src/video/SDL_surface.c        | 2 +-
e2eb78
 src/video/fbcon/SDL_fbevents.c | 2 +-
e2eb78
 src/video/fbcon/SDL_fbmatrox.c | 2 ++
e2eb78
 3 files changed, 4 insertions(+), 2 deletions(-)
e2eb78
e2eb78
diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c
e2eb78
index 0f3ad12c4..0386cb3fb 100644
e2eb78
--- a/src/video/SDL_surface.c
e2eb78
+++ b/src/video/SDL_surface.c
e2eb78
@@ -116,6 +116,7 @@ SDL_Surface * SDL_CreateRGBSurface (Uint32 flags,
e2eb78
 	surface->locked = 0;
e2eb78
 	surface->map = NULL;
e2eb78
 	surface->unused1 = 0;
e2eb78
+	surface->refcount = 1;
e2eb78
 	SDL_SetClipRect(surface, NULL);
e2eb78
 	SDL_FormatChanged(surface);
e2eb78
 
e2eb78
@@ -142,7 +143,6 @@ SDL_Surface * SDL_CreateRGBSurface (Uint32 flags,
e2eb78
 	}
e2eb78
 
e2eb78
 	/* The surface is ready to go */
e2eb78
-	surface->refcount = 1;
e2eb78
 #ifdef CHECK_LEAKS
e2eb78
 	++surfaces_allocated;
e2eb78
 #endif
e2eb78
diff --git a/src/video/fbcon/SDL_fbevents.c b/src/video/fbcon/SDL_fbevents.c
e2eb78
index 5e369a4a8..dd7413df9 100644
e2eb78
--- a/src/video/fbcon/SDL_fbevents.c
e2eb78
+++ b/src/video/fbcon/SDL_fbevents.c
e2eb78
@@ -575,7 +575,7 @@ int FB_OpenMouse(_THIS)
e2eb78
 
e2eb78
 	/* ELO TOUCHSCREEN SUPPORT */
e2eb78
 
e2eb78
-	if ( mousedrv && (SDL_strcmp(mousedrv, "ELO") == 0) ) {
e2eb78
+	if ( mousedrv && (SDL_strcmp(mousedrv, "ELO") == 0) && mousedev ) {
e2eb78
 		mouse_fd = open(mousedev, O_RDWR);
e2eb78
 		if ( mouse_fd >= 0 ) {
e2eb78
 			if(eloInitController(mouse_fd)) {
e2eb78
diff --git a/src/video/fbcon/SDL_fbmatrox.c b/src/video/fbcon/SDL_fbmatrox.c
e2eb78
index 04b90b05d..4e3da4f84 100644
e2eb78
--- a/src/video/fbcon/SDL_fbmatrox.c
e2eb78
+++ b/src/video/fbcon/SDL_fbmatrox.c
e2eb78
@@ -80,6 +80,7 @@ static int FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color)
e2eb78
 	switch (dst->format->BytesPerPixel) {
e2eb78
 	    case 1:
e2eb78
 		color |= (color<<8);
e2eb78
+		/* fallthrough */
e2eb78
 	    case 2:
e2eb78
 		color |= (color<<16);
e2eb78
 		break;
e2eb78
@@ -191,6 +192,7 @@ static int HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect,
e2eb78
 		switch (dst->format->BytesPerPixel) {
e2eb78
 		    case 1:
e2eb78
 			colorkey |= (colorkey<<8);
e2eb78
+			/* fallthrough */
e2eb78
 		    case 2:
e2eb78
 			colorkey |= (colorkey<<16);
e2eb78
 			break;
e2eb78
-- 
e2eb78
2.20.1
e2eb78