qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH V2 1/5] virtio: get_features() can fail


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH V2 1/5] virtio: get_features() can fail
Date: Wed, 15 Jul 2015 13:36:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1


On 15/07/2015 11:01, Cornelia Huck wrote:
> > 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 */
>
> Don't you need to propagate the error instead of passing it through? Or
> am I just confused by error handling? :)

Explicit propagation is only needed if you need to look at the error
(because errp could be NULL).  Here you don't need to do that, so
passing it through is fine.

Error management is not hard if you know the rules (and the rules are
not hard, just important).  Someone needs to dig up Markus's latest
explanation and put it in docs/.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]