Message ID | 2dcc2f1126686553a64d0a3c0ba82ded54a3e08f.1268905075.git.mst@redhat.com |
---|---|
State | New |
Headers | show |
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 5f61469..ab52d1d 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -32,7 +32,7 @@ typedef struct VirtIOBlock static VirtIOBlock *to_virtio_blk(VirtIODevice *vdev) { - return (VirtIOBlock *)vdev; + return container_of(vdev, VirtIOBlock, vdev); } typedef struct VirtIOBlockReq
Use container_of to remove assumption that vdev is 1st member of device state. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- hw/virtio-blk.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)