summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/s390x/s390-pci-vfio.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c
index ead4f222d5..2a153fa8c9 100644
--- a/hw/s390x/s390-pci-vfio.c
+++ b/hw/s390x/s390-pci-vfio.c
@@ -29,14 +29,11 @@
*/
bool s390_pci_update_dma_avail(int fd, unsigned int *avail)
{
- g_autofree struct vfio_iommu_type1_info *info;
- uint32_t argsz;
+ uint32_t argsz = sizeof(struct vfio_iommu_type1_info);
+ g_autofree struct vfio_iommu_type1_info *info = g_malloc0(argsz);
assert(avail);
- argsz = sizeof(struct vfio_iommu_type1_info);
- info = g_malloc0(argsz);
-
/*
* If the specified argsz is not large enough to contain all capabilities
* it will be updated upon return from the ioctl. Retry until we have
@@ -230,7 +227,7 @@ static void s390_pci_read_pfip(S390PCIBusDevice *pbdev,
*/
void s390_pci_get_clp_info(S390PCIBusDevice *pbdev)
{
- g_autofree struct vfio_device_info *info;
+ g_autofree struct vfio_device_info *info = NULL;
VFIOPCIDevice *vfio_pci;
uint32_t argsz;
int fd;