aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/acpi/aml-build.c13
-rw-r--r--hw/audio/intel-hda.c5
-rw-r--r--hw/display/vga.c4
-rw-r--r--hw/ide/qdev.c4
-rw-r--r--hw/intc/s390_flic_kvm.c5
-rw-r--r--hw/net/ne2000-isa.c4
-rw-r--r--hw/pci-host/uninorth.c5
-rw-r--r--hw/ppc/spapr_vio.c5
-rw-r--r--hw/s390x/s390-virtio-ccw.c4
-rw-r--r--hw/s390x/virtio-ccw.c42
-rw-r--r--hw/scsi/megasas.c5
-rw-r--r--hw/scsi/scsi-generic.c5
-rw-r--r--hw/timer/mc146818rtc.c4
-rw-r--r--hw/usb/dev-storage.c4
-rw-r--r--hw/virtio/virtio-pci.c4
15 files changed, 24 insertions, 89 deletions
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 123160a94e..874e473cac 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -324,12 +324,9 @@ static void aml_free(gpointer data, gpointer user_data)
Aml *init_aml_allocator(void)
{
- Aml *var;
-
assert(!alloc_list);
alloc_list = g_ptr_array_new();
- var = aml_alloc();
- return var;
+ return aml_alloc();
}
void free_aml_allocator(void)
@@ -451,12 +448,10 @@ Aml *aml_name_decl(const char *name, Aml *val)
/* ACPI 1.0b: 16.2.6.1 Arg Objects Encoding */
Aml *aml_arg(int pos)
{
- Aml *var;
uint8_t op = 0x68 /* ARG0 op */ + pos;
assert(pos <= 6);
- var = aml_opcode(op);
- return var;
+ return aml_opcode(op);
}
/* ACPI 2.0a: 17.2.4.4 Type 2 Opcodes Encoding: DefToInteger */
@@ -1082,12 +1077,10 @@ Aml *aml_string(const char *name_format, ...)
/* ACPI 1.0b: 16.2.6.2 Local Objects Encoding */
Aml *aml_local(int num)
{
- Aml *var;
uint8_t op = 0x60 /* Local0Op */ + num;
assert(num <= 7);
- var = aml_opcode(op);
- return var;
+ return aml_opcode(op);
}
/* ACPI 2.0a: 17.2.2 Data Objects Encoding: DefVarPackage */
diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index 93d7669fb5..098b17d020 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -219,10 +219,7 @@ static void intel_hda_reset(DeviceState *dev);
static hwaddr intel_hda_addr(uint32_t lbase, uint32_t ubase)
{
- hwaddr addr;
-
- addr = ((uint64_t)ubase << 32) | lbase;
- return addr;
+ return ((uint64_t)ubase << 32) | lbase;
}
static void intel_hda_update_int_sts(IntelHDAState *d)
diff --git a/hw/display/vga.c b/hw/display/vga.c
index 9ebc54f22b..2a88b3c1b4 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -700,9 +700,7 @@ static void vbe_update_vgaregs(VGACommonState *s)
static uint32_t vbe_ioport_read_index(void *opaque, uint32_t addr)
{
VGACommonState *s = opaque;
- uint32_t val;
- val = s->vbe_index;
- return val;
+ return s->vbe_index;
}
uint32_t vbe_ioport_read_data(void *opaque, uint32_t addr)
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 4bc74a32d2..6842a5596a 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -233,9 +233,7 @@ static void ide_dev_set_bootindex(Object *obj, Visitor *v, const char *name,
d->unit ? "/disk@1" : "/disk@0");
}
out:
- if (local_err) {
- error_propagate(errp, local_err);
- }
+ error_propagate(errp, local_err);
}
static void ide_dev_instance_init(Object *obj)
diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c
index 680857f0c7..fef808011f 100644
--- a/hw/intc/s390_flic_kvm.c
+++ b/hw/intc/s390_flic_kvm.c
@@ -195,7 +195,7 @@ static int kvm_s390_register_io_adapter(S390FLICState *fs, uint32_t id,
.swap = swap,
};
KVMS390FLICState *flic = KVM_S390_FLIC(fs);
- int r, ret;
+ int r;
struct kvm_device_attr attr = {
.group = KVM_DEV_FLIC_ADAPTER_REGISTER,
.addr = (uint64_t)&adapter,
@@ -208,8 +208,7 @@ static int kvm_s390_register_io_adapter(S390FLICState *fs, uint32_t id,
r = ioctl(flic->fd, KVM_SET_DEVICE_ATTR, &attr);
- ret = r ? -errno : 0;
- return ret;
+ return r ? -errno : 0;
}
static int kvm_s390_io_adapter_map(S390FLICState *fs, uint32_t id,
diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c
index a7f5a9464d..8fab7ae2ec 100644
--- a/hw/net/ne2000-isa.c
+++ b/hw/net/ne2000-isa.c
@@ -127,9 +127,7 @@ static void isa_ne2000_set_bootindex(Object *obj, Visitor *v,
s->c.bootindex = boot_index;
out:
- if (local_err) {
- error_propagate(errp, local_err);
- }
+ error_propagate(errp, local_err);
}
static void isa_ne2000_instance_init(Object *obj)
diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
index 15b1054232..7aac4d67a4 100644
--- a/hw/pci-host/uninorth.c
+++ b/hw/pci-host/uninorth.c
@@ -62,12 +62,9 @@ typedef struct UNINState {
static int pci_unin_map_irq(PCIDevice *pci_dev, int irq_num)
{
- int retval;
int devfn = pci_dev->devfn & 0x00FFFFFF;
- retval = (((devfn >> 11) & 0x1F) + irq_num) & 3;
-
- return retval;
+ return (((devfn >> 11) & 0x1F) + irq_num) & 3;
}
static void pci_unin_set_irq(void *opaque, int irq_num, int level)
diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
index 3d9b9c60f4..ae40db8fd2 100644
--- a/hw/ppc/spapr_vio.c
+++ b/hw/ppc/spapr_vio.c
@@ -57,12 +57,9 @@ static char *spapr_vio_get_dev_name(DeviceState *qdev)
{
VIOsPAPRDevice *dev = VIO_SPAPR_DEVICE(qdev);
VIOsPAPRDeviceClass *pc = VIO_SPAPR_DEVICE_GET_CLASS(dev);
- char *name;
/* Device tree style name device@reg */
- name = g_strdup_printf("%s@%x", pc->dt_name, dev->reg);
-
- return name;
+ return g_strdup_printf("%s@%x", pc->dt_name, dev->reg);
}
static void spapr_vio_bus_class_init(ObjectClass *klass, void *data)
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index e257ca5ab0..52f079a884 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -180,10 +180,8 @@ static HotplugHandler *s390_get_hotplug_handler(MachineState *machine,
static void s390_hot_add_cpu(const int64_t id, Error **errp)
{
MachineState *machine = MACHINE(qdev_get_machine());
- Error *err = NULL;
- s390x_new_cpu(machine->cpu_model, id, &err);
- error_propagate(errp, err);
+ s390x_new_cpu(machine->cpu_model, id, errp);
}
static void ccw_machine_class_init(ObjectClass *oc, void *data)
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 2192be8774..1625e6b38b 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -884,15 +884,11 @@ static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp)
DeviceState *qdev = DEVICE(ccw_dev);
VirtIONetCcw *dev = VIRTIO_NET_CCW(ccw_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- Error *err = NULL;
virtio_net_set_netclient_name(&dev->vdev, qdev->id,
object_get_typename(OBJECT(qdev)));
qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", &err);
- if (err) {
- error_propagate(errp, err);
- }
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_ccw_net_instance_init(Object *obj)
@@ -909,13 +905,9 @@ static void virtio_ccw_blk_realize(VirtioCcwDevice *ccw_dev, Error **errp)
{
VirtIOBlkCcw *dev = VIRTIO_BLK_CCW(ccw_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- Error *err = NULL;
qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", &err);
- if (err) {
- error_propagate(errp, err);
- }
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_ccw_blk_instance_init(Object *obj)
@@ -935,7 +927,6 @@ static void virtio_ccw_serial_realize(VirtioCcwDevice *ccw_dev, Error **errp)
VirtioSerialCcw *dev = VIRTIO_SERIAL_CCW(ccw_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
DeviceState *proxy = DEVICE(ccw_dev);
- Error *err = NULL;
char *bus_name;
/*
@@ -949,10 +940,7 @@ static void virtio_ccw_serial_realize(VirtioCcwDevice *ccw_dev, Error **errp)
}
qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", &err);
- if (err) {
- error_propagate(errp, err);
- }
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
@@ -968,13 +956,9 @@ static void virtio_ccw_balloon_realize(VirtioCcwDevice *ccw_dev, Error **errp)
{
VirtIOBalloonCcw *dev = VIRTIO_BALLOON_CCW(ccw_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- Error *err = NULL;
qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", &err);
- if (err) {
- error_propagate(errp, err);
- }
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_ccw_balloon_instance_init(Object *obj)
@@ -995,7 +979,6 @@ static void virtio_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp)
VirtIOSCSICcw *dev = VIRTIO_SCSI_CCW(ccw_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
DeviceState *qdev = DEVICE(ccw_dev);
- Error *err = NULL;
char *bus_name;
/*
@@ -1009,10 +992,7 @@ static void virtio_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp)
}
qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", &err);
- if (err) {
- error_propagate(errp, err);
- }
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_ccw_scsi_instance_init(Object *obj)
@@ -1030,13 +1010,9 @@ static void vhost_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp)
{
VHostSCSICcw *dev = VHOST_SCSI_CCW(ccw_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- Error *err = NULL;
qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", &err);
- if (err) {
- error_propagate(errp, err);
- }
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void vhost_ccw_scsi_instance_init(Object *obj)
@@ -1854,13 +1830,9 @@ static void virtio_ccw_9p_realize(VirtioCcwDevice *ccw_dev, Error **errp)
{
V9fsCCWState *dev = VIRTIO_9P_CCW(ccw_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- Error *err = NULL;
qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", &err);
- if (err) {
- error_propagate(errp, err);
- }
+ object_property_set_bool(OBJECT(vdev), true, "realized", errp);
}
static void virtio_ccw_9p_class_init(ObjectClass *klass, void *data)
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index a9ffc32682..d1772183cf 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -410,17 +410,14 @@ static void megasas_encode_lba(uint8_t *cdb, uint64_t lba,
static uint64_t megasas_fw_time(void)
{
struct tm curtime;
- uint64_t bcd_time;
qemu_get_timedate(&curtime, 0);
- bcd_time = ((uint64_t)curtime.tm_sec & 0xff) << 48 |
+ return ((uint64_t)curtime.tm_sec & 0xff) << 48 |
((uint64_t)curtime.tm_min & 0xff) << 40 |
((uint64_t)curtime.tm_hour & 0xff) << 32 |
((uint64_t)curtime.tm_mday & 0xff) << 24 |
((uint64_t)curtime.tm_mon & 0xff) << 16 |
((uint64_t)(curtime.tm_year + 1900) & 0xffff);
-
- return bcd_time;
}
/*
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 71372a8383..6a2d89afba 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -579,10 +579,7 @@ const SCSIReqOps scsi_generic_req_ops = {
static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun,
uint8_t *buf, void *hba_private)
{
- SCSIRequest *req;
-
- req = scsi_req_alloc(&scsi_generic_req_ops, d, tag, lun, hba_private);
- return req;
+ return scsi_req_alloc(&scsi_generic_req_ops, d, tag, lun, hba_private);
}
static Property scsi_generic_properties[] = {
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index a11b8b4b21..f4e333eb8f 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -105,12 +105,10 @@ static inline bool rtc_running(RTCState *s)
static uint64_t get_guest_rtc_ns(RTCState *s)
{
- uint64_t guest_rtc;
uint64_t guest_clock = qemu_clock_get_ns(rtc_clock);
- guest_rtc = s->base_rtc * NANOSECONDS_PER_SECOND +
+ return s->base_rtc * NANOSECONDS_PER_SECOND +
guest_clock - s->last_update + s->offset;
- return guest_rtc;
}
#ifdef TARGET_I386
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index 248a580457..9fd00dfffc 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -818,9 +818,7 @@ static void usb_msd_set_bootindex(Object *obj, Visitor *v, const char *name,
}
out:
- if (local_err) {
- error_propagate(errp, local_err);
- }
+ error_propagate(errp, local_err);
}
static const TypeInfo usb_storage_dev_type_info = {
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index bfedbbf17f..1a0278304b 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -761,9 +761,7 @@ static int kvm_virtio_pci_irqfd_use(VirtIOPCIProxy *proxy,
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
VirtQueue *vq = virtio_get_queue(vdev, queue_no);
EventNotifier *n = virtio_queue_get_guest_notifier(vq);
- int ret;
- ret = kvm_irqchip_add_irqfd_notifier_gsi(kvm_state, n, NULL, irqfd->virq);
- return ret;
+ return kvm_irqchip_add_irqfd_notifier_gsi(kvm_state, n, NULL, irqfd->virq);
}
static void kvm_virtio_pci_irqfd_release(VirtIOPCIProxy *proxy,