qemu-patch-raspberry4/hw
Peter Maydell 41742927ee hw/i2c/bitbang_i2c: Use in-place rather than malloc'd bitbang_i2c_interface struct
Currently the bitbang_i2c_init() function allocates a
bitbang_i2c_interface struct which it returns.  This is unfortunate
because it means that if the function is used from a DeviceState
init method then the memory will be leaked by an "init then delete"
cycle, as used by the qmp/hmp commands that list device properties.

Since three out of four of the uses of this function are in
device init methods, switch the function to do an in-place
initialization of a struct that can be embedded in the
device state struct of the caller.

This fixes LeakSanitizer leak warnings that have appeared in the
patchew configuration (which only tries to run the sanitizers
for the x86_64-softmmu target) now that we use the bitbang-i2c
code in an x86-64 config.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Tested-by: BALATON Zoltan <balaton@eik.bme.hu>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20190702163844.20458-1-peter.maydell@linaro.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-07-03 10:51:35 +02:00
..
9pfs xen: Import other xen/io/*.h 2019-06-24 10:42:30 +01:00
acpi hw/acpi: extract acpi_add_rom_blob() 2019-06-16 16:16:52 -04:00
adc Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
alpha Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
arm hw/arm: Add arm SBSA reference machine, devices part 2019-07-01 17:29:00 +01:00
audio Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
block hw/block/pflash_cfi02: Reduce I/O accesses to 16-bit 2019-07-02 02:34:55 +02:00
bt Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
char xen: Import other xen/io/*.h 2019-06-24 10:42:30 +01:00
core hw: Nuke hw_compat_4_0_1 and pc_compat_4_0_1 2019-06-21 13:25:29 +02:00
cpu Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
cris Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
display hw/i2c/bitbang_i2c: Use in-place rather than malloc'd bitbang_i2c_interface struct 2019-07-03 10:51:35 +02:00
dma dma/rc4030: Minor code style cleanup 2019-06-26 13:25:07 +02:00
gpio Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
hppa Supply missing header guards 2019-06-12 13:20:21 +02:00
hyperv Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
i2c hw/i2c/bitbang_i2c: Use in-place rather than malloc'd bitbang_i2c_interface struct 2019-07-03 10:51:35 +02:00
i386 xen: Drop includes of xen/hvm/params.h 2019-06-24 10:42:30 +01:00
ide Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
input Supply missing header guards 2019-06-12 13:20:21 +02:00
intc ppc patch queue 2019-07-2 2019-07-02 18:56:44 +01:00
ipack Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
ipmi Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
isa Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
lm32 Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
m68k Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
mem Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
microblaze Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
mips hw/mips/gt64xxx_pci: Align the pci0-mem size 2019-06-26 13:23:27 +02:00
misc hw/misc/aspeed_xdma: New device 2019-07-01 17:29:00 +01:00
moxie Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
net net/announce: Add optional ID 2019-07-02 10:21:06 +08:00
nios2 Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
nvram Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
openrisc Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
pci Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
pci-bridge Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
pci-host i.mx7d: pci: Update PCI IRQ mapping to match HW 2019-07-01 17:28:59 +01:00
pcmcia Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
ppc spapr/xive: simplify spapr_irq_init_device() to remove the emulated init 2019-07-02 09:43:58 +10:00
rdma Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
riscv Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
s390x vfio-ccw: support async command subregion 2019-06-24 17:27:57 +02:00
scsi Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
sd sd: Fix out-of-bounds assertions 2019-06-21 13:25:29 +02:00
semihosting semihosting: split console_out into string and char versions 2019-06-12 17:53:22 +01:00
sh4 Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
smbios Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
sparc Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
sparc64 Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
ssi aspeed/smc: add a 'sdram_base' property 2019-07-01 17:28:59 +01:00
timer aspeed/timer: Ensure positive muldiv delta 2019-07-01 17:28:59 +01:00
tpm Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
tricore Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
unicore32 target/unicore32: Use env_cpu, env_archcpu 2019-06-10 07:03:42 -07:00
usb xen: Import other xen/io/*.h 2019-06-24 10:42:30 +01:00
vfio vfio-ccw: support async command subregion 2019-06-24 17:27:57 +02:00
virtio vhost: fix vhost_log size overflow during migration 2019-06-16 16:16:52 -04:00
watchdog aspeed: Link SCU to the watchdog 2019-07-01 17:29:00 +01:00
xen xen: Import other xen/io/*.h 2019-06-24 10:42:30 +01:00
xenpv xen: Replace few mentions of xend by libxl 2019-01-14 13:45:40 +00:00
xtensa Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
Kconfig semihosting: introduce CONFIG_SEMIHOSTING 2019-05-28 10:28:50 +01:00
Makefile.objs semihosting: move semihosting configuration into its own directory 2019-05-28 10:28:50 +01:00