diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2023-10-16 17:00:53 +0200 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2023-10-19 23:13:28 +0200 |
commit | 5960f254dbb46f0c7a9f5f44bf4d27c19c34cb97 (patch) | |
tree | 04e43e7a1612e5f75604a6f2280fefc9e339108d /hw | |
parent | 840b4495ef5c2d90d75f3f0d00d9018146f27d8e (diff) | |
download | qemu-5960f254dbb46f0c7a9f5f44bf4d27c19c34cb97.zip qemu-5960f254dbb46f0c7a9f5f44bf4d27c19c34cb97.tar.gz qemu-5960f254dbb46f0c7a9f5f44bf4d27c19c34cb97.tar.bz2 |
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>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/virtio/virtio-pmem.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c index c3512c2..cc24812 100644 --- a/hw/virtio/virtio-pmem.c +++ b/hw/virtio/virtio-pmem.c @@ -147,10 +147,7 @@ static void virtio_pmem_fill_device_info(const VirtIOPMEM *pmem, static MemoryRegion *virtio_pmem_get_memory_region(VirtIOPMEM *pmem, Error **errp) { - if (!pmem->memdev) { - error_setg(errp, "'%s' property must be set", VIRTIO_PMEM_MEMDEV_PROP); - return NULL; - } + assert(pmem->memdev); return &pmem->memdev->mr; } |