video: fix Coverity missing break issue
authorAnatolij Gustschin <agust@denx.de>
Mon, 6 Jan 2020 22:00:38 +0000 (23:00 +0100)
committerAnatolij Gustschin <agust@denx.de>
Tue, 4 Feb 2020 22:02:56 +0000 (23:02 +0100)
Fix:
>>>  CID 280902:  Control flow issues  (MISSING_BREAK)
>>>  The case for value "VIDEO_BPP32" is not terminated
>>>  by a 'break' statement.

Also fix
error: control reaches end of non-void function [-Werror=return-type]

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/video/vidconsole-uclass.c

index 75c7e25095d21c3d400a71f36993563887b4b7c7..8e0fc7f3ecf1cb90875fadda2f0445cc9580b934 100644 (file)
@@ -144,22 +144,26 @@ u32 vid_console_color(struct video_priv *priv, unsigned int idx)
                               ((colors[idx].g >> 2) <<  5) |
                               ((colors[idx].b >> 3) <<  0);
                }
+               break;
        case VIDEO_BPP32:
                if (CONFIG_IS_ENABLED(VIDEO_BPP32)) {
                        return (colors[idx].r << 16) |
                               (colors[idx].g <<  8) |
                               (colors[idx].b <<  0);
                }
+               break;
        default:
-               /*
-                * For unknown bit arrangements just support
-                * black and white.
-                */
-               if (idx)
-                       return 0xffffff; /* white */
-               else
-                       return 0x000000; /* black */
+               break;
        }
+
+       /*
+        * For unknown bit arrangements just support
+        * black and white.
+        */
+       if (idx)
+               return 0xffffff; /* white */
+
+       return 0x000000; /* black */
 }
 
 static char *parsenum(char *s, int *num)