Trivial patches 20210118

Fix memory leaks
 Use qemu_log_mask(GUEST_ERROR) rather than error_report().
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmAFcX4SHGxhdXJlbnRA
 dml2aWVyLmV1AAoJEPMMOL0/L7483L8QAK5B+Er/SS8P2gDGeQExfEaORYhNq3Kq
 cuFITBsZ7Sr8UVy6C6H8KNu32RmHOu6FXL+P7GjiO9sZAQVz9MpdMhmxKAwyke78
 RRx6bUtkuuznk9LqRh3NrNzbpu/f5bQWoRVYQ5kBhcFwLaEJAFqyckanIeNHOq4L
 v4JMcqABrh97hTfZKwx+jnbTrfgbkjTlmF1/jfzEJnBIEPYZ51gmq9/Nyi+SvcWG
 8M0jprCWocZgSWnRpEse+/bkuXgZKGZOvTQjLd4Hs167QnGXUnb88/2gjONZ2Je2
 YJFIaVP837T6Bx7XplexznlENBFpLxI6GXKvtJc+FaqSrqMOLvRvrr/mZxXK2OeM
 4TMozqjm0KFJLKq5QPmigLgJyHIHXkW57A+R7ihgzvXcNe6DDm/zuI3oeEikcnSI
 t/msb2UNF1unwtALxiDwDBc7B8x3Gf6GmedF/3JZs2IRat6NOMb0XEi28i+hXguc
 4lV3sZT4eCXsIwgDoulKKI/G39yE4Of6lTWIFFULxQZvlPBsVIUmHXbhC1WfCmk6
 O5ZJd26YF9qO6Wepouv9lMzMTSq4YkdK7SfxrG1WZOHqCsVkVV2THWX7Mpybz3T4
 L5SDrlsy+3ItNBaAX5f0twotKwc1Rcsw90JnfIXUzU6yMNQDGmMDPI9Yum7XIMX4
 eOVf4UIHDVSH
 =B5ep
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Peter Maydell 2021-01-18 15:19:06 +00:00
commit e43d564fa3
4 changed files with 26 additions and 5 deletions

View File

@ -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;
}

View File

@ -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,

View File

@ -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,
};

View File

@ -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;
}
}