diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
index 685cb5413e..ca1bb09816 100644
--- a/hw/s390-virtio.c
+++ b/hw/s390-virtio.c
@@ -155,7 +155,6 @@ unsigned s390_del_running_cpu(CPUS390XState *env)
 static void s390_init(QEMUMachineInitArgs *args)
 {
     ram_addr_t my_ram_size = args->ram_size;
-    ram_addr_t ram_size = args->ram_size;
     const char *cpu_model = args->cpu_model;
     const char *kernel_filename = args->kernel_filename;
     const char *kernel_cmdline = args->kernel_cmdline;
diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c
index 93676602a7..bc9cea9e1b 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);