From 9d5b731dd2d64deb3bc798ef4e3c08603d54ae02 Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Mon, 27 Jul 2015 17:49:19 +0800 Subject: virtio: get_features() can fail Signed-off-by: Jason Wang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Acked-by: Paolo Bonzini --- hw/virtio/virtio-balloon.c | 3 ++- hw/virtio/virtio-bus.c | 3 ++- hw/virtio/virtio-rng.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'hw/virtio') diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 2990f8d..3577b7a 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -310,7 +310,8 @@ static void virtio_balloon_set_config(VirtIODevice *vdev, trace_virtio_balloon_set_config(dev->actual, oldactual); } -static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f) +static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f, + Error **errp) { VirtIOBalloon *dev = VIRTIO_BALLOON(vdev); f |= dev->host_features; diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index 3926f7e..febda76 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -54,7 +54,8 @@ void virtio_bus_device_plugged(VirtIODevice *vdev, Error **errp) /* Get the features of the plugged device. */ assert(vdc->get_features != NULL); - vdev->host_features = vdc->get_features(vdev, vdev->host_features); + vdev->host_features = vdc->get_features(vdev, vdev->host_features, + errp); } /* Reset the virtio_bus */ diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index 6e5f022..97d1541 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -104,7 +104,7 @@ static void handle_input(VirtIODevice *vdev, VirtQueue *vq) virtio_rng_process(vrng); } -static uint64_t get_features(VirtIODevice *vdev, uint64_t f) +static uint64_t get_features(VirtIODevice *vdev, uint64_t f, Error **errp) { return f; } -- cgit v1.1