Patchwork vga: Silence bogus gcc warning about uninitialized variables

login
register
mail settings
Submitter Jan Kiszka
Date Aug. 25, 2011, 9:10 a.m.
Message ID <4E561175.8080800@siemens.com>
Download mbox | patch
Permalink /patch/111529/
State New
Headers show

Comments

Jan Kiszka - Aug. 25, 2011, 9:10 a.m.
Some gcc versions do not properly detect that all possible cases are
covered and base and size are always initialized. Please gcc by defining
a pseudo default case.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/vga.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Anthony Liguori - Aug. 25, 2011, 10:41 p.m.
On 08/25/2011 04:10 AM, Jan Kiszka wrote:
> Some gcc versions do not properly detect that all possible cases are
> covered and base and size are always initialized. Please gcc by defining
> a pseudo default case.
>
> Signed-off-by: Jan Kiszka<jan.kiszka@siemens.com>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   hw/vga.c |    1 +
>   1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/hw/vga.c b/hw/vga.c
> index 851fd68..125fb29 100644
> --- a/hw/vga.c
> +++ b/hw/vga.c
> @@ -176,6 +176,7 @@ static void vga_update_memory_access(VGACommonState *s)
>               size = 0x8000;
>               break;
>           case 3:
> +        default:
>               base = 0xb8000;
>               size = 0x8000;
>               break;

Patch

diff --git a/hw/vga.c b/hw/vga.c
index 851fd68..125fb29 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -176,6 +176,7 @@  static void vga_update_memory_access(VGACommonState *s)
             size = 0x8000;
             break;
         case 3:
+        default:
             base = 0xb8000;
             size = 0x8000;
             break;