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