Patchwork [3/3] sclp: Fix uninitialized var in handle_write_event_buf().

login
register
mail settings
Submitter Jens Freimann
Date Nov. 23, 2012, 10:18 a.m.
Message ID <1353665892-35445-4-git-send-email-jfrei@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/201283/
State New
Headers show

Comments

Jens Freimann - Nov. 23, 2012, 10:18 a.m.
From: Cornelia Huck <cornelia.huck@de.ibm.com>

Some gcc versions rightly complain about a possibly unitialized rc,
so let's move setting it before the QTAILQ_FOREACH().

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
---
 hw/s390x/event-facility.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Alexander Graf - Nov. 23, 2012, 1:42 p.m.
On 23.11.2012, at 11:18, Jens Freimann wrote:

> From: Cornelia Huck <cornelia.huck@de.ibm.com>
> 
> Some gcc versions rightly complain about a possibly unitialized rc,
> so let's move setting it before the QTAILQ_FOREACH().
> 
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>

Thanks, applied to s390-next.


Alex

Patch

diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c
index 9367660..bc9cea9 100644
--- a/hw/s390x/event-facility.c
+++ b/hw/s390x/event-facility.c
@@ -112,12 +112,13 @@  static uint16_t handle_write_event_buf(SCLPEventFacility *ef,
     SCLPEvent *event;
     SCLPEventClass *ec;
 
+    rc = SCLP_RC_INVALID_FUNCTION;
+
     QTAILQ_FOREACH(kid, &ef->sbus.qbus.children, sibling) {
         DeviceState *qdev = kid->child;
         event = (SCLPEvent *) qdev;
         ec = SCLP_EVENT_GET_CLASS(event);
 
-        rc = SCLP_RC_INVALID_FUNCTION;
         if (ec->write_event_data &&
             ec->event_type() == event_buf->type) {
             rc = ec->write_event_data(event, event_buf);