hw/virtio/virtio-pmem: Replace impossible check by assertion
The get_memory_region() handler is used when (un)plugging the device, which can only occur *after* it is realized. virtio_pmem_realize() ensure the instance can not be realized without 'memdev'. Remove the superfluous check, replacing it by an assertion. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-Id: <20231017140150.44995-2-philmd@linaro.org>
This commit is contained in:
parent
840b4495ef
commit
5960f254db
@ -147,10 +147,7 @@ static void virtio_pmem_fill_device_info(const VirtIOPMEM *pmem,
|
|||||||
static MemoryRegion *virtio_pmem_get_memory_region(VirtIOPMEM *pmem,
|
static MemoryRegion *virtio_pmem_get_memory_region(VirtIOPMEM *pmem,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
if (!pmem->memdev) {
|
assert(pmem->memdev);
|
||||||
error_setg(errp, "'%s' property must be set", VIRTIO_PMEM_MEMDEV_PROP);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return &pmem->memdev->mr;
|
return &pmem->memdev->mr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user