[common] ivshmem: check for failure to find a device

This commit is contained in:
Geoffrey McRae 2022-01-25 03:37:13 +11:00
parent 11800029f0
commit 905c1d7f58

View File

@ -132,6 +132,13 @@ bool ivshmemInit(struct IVSHMEM * dev)
i == shmDevice ? '*' : ' ', bus, addr >> 16, addr & 0xFFFF); i == shmDevice ? '*' : ' ', bus, addr >> 16, addr & 0xFFFF);
} }
if (!device)
{
vector_destroy(&devices);
DEBUG_ERROR("Unable to find a IVSHMEM device");
return false;
}
device = vector_ptrTo(&devices, shmDevice); device = vector_ptrTo(&devices, shmDevice);
memcpy(&devInfoData, &device->devInfoData, sizeof(SP_DEVINFO_DATA)); memcpy(&devInfoData, &device->devInfoData, sizeof(SP_DEVINFO_DATA));
vector_destroy(&devices); vector_destroy(&devices);