diff mbox

x86/vIO-APIC: fix uninitialized variable warning

Message ID 58EFA7710200007800150CA9@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich April 13, 2017, 2:29 p.m. UTC
In a release build modern gcc validly complains about "pin" possibly
being uninitialized in vioapic_irq_positive_edge().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
x86/vIO-APIC: fix uninitialized variable warning

In a release build modern gcc validly complains about "pin" possibly
being uninitialized in vioapic_irq_positive_edge().

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -421,7 +421,11 @@ void vioapic_irq_positive_edge(struct do
     struct hvm_vioapic *vioapic = gsi_vioapic(d, irq, &pin);
     union vioapic_redir_entry *ent;
 
-    ASSERT(vioapic);
+    if ( !vioapic )
+    {
+        ASSERT_UNREACHABLE();
+        return;
+    }
 
     HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "irq %x", irq);

Comments

Andrew Cooper April 13, 2017, 2:37 p.m. UTC | #1
On 13/04/17 15:29, Jan Beulich wrote:
> In a release build modern gcc validly complains about "pin" possibly
> being uninitialized in vioapic_irq_positive_edge().
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

>
> --- a/xen/arch/x86/hvm/vioapic.c
> +++ b/xen/arch/x86/hvm/vioapic.c
> @@ -421,7 +421,11 @@ void vioapic_irq_positive_edge(struct do
>      struct hvm_vioapic *vioapic = gsi_vioapic(d, irq, &pin);
>      union vioapic_redir_entry *ent;
>  
> -    ASSERT(vioapic);
> +    if ( !vioapic )
> +    {
> +        ASSERT_UNREACHABLE();
> +        return;
> +    }
>  
>      HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "irq %x", irq);
>  
>
>
>
Julien Grall April 13, 2017, 2:39 p.m. UTC | #2
On 13/04/17 15:37, Andrew Cooper wrote:
> On 13/04/17 15:29, Jan Beulich wrote:
>> In a release build modern gcc validly complains about "pin" possibly
>> being uninitialized in vioapic_irq_positive_edge().
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

Release-acked-by: Julien Grall <julien.grall@arm.com>

Cheers,

>
>>
>> --- a/xen/arch/x86/hvm/vioapic.c
>> +++ b/xen/arch/x86/hvm/vioapic.c
>> @@ -421,7 +421,11 @@ void vioapic_irq_positive_edge(struct do
>>      struct hvm_vioapic *vioapic = gsi_vioapic(d, irq, &pin);
>>      union vioapic_redir_entry *ent;
>>
>> -    ASSERT(vioapic);
>> +    if ( !vioapic )
>> +    {
>> +        ASSERT_UNREACHABLE();
>> +        return;
>> +    }
>>
>>      HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "irq %x", irq);
>>
>>
>>
>>
>
diff mbox

Patch

--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -421,7 +421,11 @@  void vioapic_irq_positive_edge(struct do
     struct hvm_vioapic *vioapic = gsi_vioapic(d, irq, &pin);
     union vioapic_redir_entry *ent;
 
-    ASSERT(vioapic);
+    if ( !vioapic )
+    {
+        ASSERT_UNREACHABLE();
+        return;
+    }
 
     HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "irq %x", irq);