aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-01-18 15:19:06 +0000
committerPeter Maydell <peter.maydell@linaro.org>2021-01-18 15:19:06 +0000
commite43d564fa3a0d1e133935c8180ad4f4ccf699f33 (patch)
tree65874cd221c8b3b0fe6dc0fe3f2289d6a46cda31 /hw
parent8814b1327c0070d440ec1480888b77eb27af43f8 (diff)
parent580e733321511ab4eda7d6ca14ca157d71ea8728 (diff)
downloadqemu-e43d564fa3a0d1e133935c8180ad4f4ccf699f33.zip
qemu-e43d564fa3a0d1e133935c8180ad4f4ccf699f33.tar.gz
qemu-e43d564fa3a0d1e133935c8180ad4f4ccf699f33.tar.bz2
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-for-6.0-pull-request' into staging
Trivial patches 20210118 Fix memory leaks Use qemu_log_mask(GUEST_ERROR) rather than error_report(). # gpg: Signature made Mon 18 Jan 2021 11:31:10 GMT # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/trivial-branch-for-6.0-pull-request: hw/ide/ahci: Replace fprintf() by qemu_log_mask(GUEST_ERROR) misc/mos6522: Use timer_free() in the finalize function to avoid memleak pl031: Use timer_free() in the finalize function to avoid memleaks hw/virtio-pci: Replace error_report() by qemu_log_mask(GUEST_ERROR) Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/ide/ahci.c8
-rw-r--r--hw/misc/mos6522.c9
-rw-r--r--hw/rtc/pl031.c8
-rw-r--r--hw/virtio/virtio-pci.c6
4 files changed, 26 insertions, 5 deletions
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 4b675b9..6d50482 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -465,8 +465,9 @@ static void ahci_mem_write(void *opaque, hwaddr addr,
/* Only aligned reads are allowed on AHCI */
if (addr & 3) {
- fprintf(stderr, "ahci: Mis-aligned write to addr 0x"
- TARGET_FMT_plx "\n", addr);
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "ahci: Mis-aligned write to addr 0x%03" HWADDR_PRIX "\n",
+ addr);
return;
}
@@ -1111,7 +1112,8 @@ static void process_ncq_command(AHCIState *s, int port, uint8_t *cmd_fis,
g_assert(is_ncq(ncq_fis->command));
if (ncq_tfs->used) {
/* error - already in use */
- fprintf(stderr, "%s: tag %d already used\n", __func__, tag);
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: tag %d already used\n",
+ __func__, tag);
return;
}
diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c
index ac4cd1d..1c57332 100644
--- a/hw/misc/mos6522.c
+++ b/hw/misc/mos6522.c
@@ -490,6 +490,14 @@ static void mos6522_init(Object *obj)
s->timers[1].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, mos6522_timer2, s);
}
+static void mos6522_finalize(Object *obj)
+{
+ MOS6522State *s = MOS6522(obj);
+
+ timer_free(s->timers[0].timer);
+ timer_free(s->timers[1].timer);
+}
+
static Property mos6522_properties[] = {
DEFINE_PROP_UINT64("frequency", MOS6522State, frequency, 0),
DEFINE_PROP_END_OF_LIST()
@@ -519,6 +527,7 @@ static const TypeInfo mos6522_type_info = {
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(MOS6522State),
.instance_init = mos6522_init,
+ .instance_finalize = mos6522_finalize,
.abstract = true,
.class_size = sizeof(MOS6522DeviceClass),
.class_init = mos6522_class_init,
diff --git a/hw/rtc/pl031.c b/hw/rtc/pl031.c
index ae47f09..2bbb206 100644
--- a/hw/rtc/pl031.c
+++ b/hw/rtc/pl031.c
@@ -194,6 +194,13 @@ static void pl031_init(Object *obj)
s->timer = timer_new_ns(rtc_clock, pl031_interrupt, s);
}
+static void pl031_finalize(Object *obj)
+{
+ PL031State *s = PL031(obj);
+
+ timer_free(s->timer);
+}
+
static int pl031_pre_save(void *opaque)
{
PL031State *s = opaque;
@@ -329,6 +336,7 @@ static const TypeInfo pl031_info = {
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(PL031State),
.instance_init = pl031_init,
+ .instance_finalize = pl031_finalize,
.class_init = pl031_class_init,
};
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index f863f69..094c36a 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -27,6 +27,7 @@
#include "hw/qdev-properties.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
+#include "qemu/log.h"
#include "qemu/module.h"
#include "hw/pci/msi.h"
#include "hw/pci/msix.h"
@@ -365,8 +366,9 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
virtio_queue_set_vector(vdev, vdev->queue_sel, val);
break;
default:
- error_report("%s: unexpected address 0x%x value 0x%x",
- __func__, addr, val);
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "%s: unexpected address 0x%x value 0x%x\n",
+ __func__, addr, val);
break;
}
}