qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 2/4] Add Error **errp for xen_pt_setup_vga()


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v3 2/4] Add Error **errp for xen_pt_setup_vga()
Date: Wed, 6 Jan 2016 08:53:24 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

On 01/05/2016 07:39 PM, Cao jin wrote:
> To catch the error msg. Also modify the caller
> 
> Signed-off-by: Cao jin <address@hidden>
> Reviewed-by: Stefano Stabellini <address@hidden>
> ---
>  hw/xen/xen_pt.c          |  5 ++++-
>  hw/xen/xen_pt.h          |  3 ++-
>  hw/xen/xen_pt_graphics.c | 11 ++++++-----
>  3 files changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
> index 1bd4109..fbce55c 100644
> --- a/hw/xen/xen_pt.c
> +++ b/hw/xen/xen_pt.c
> @@ -807,7 +807,10 @@ static int xen_pt_initfn(PCIDevice *d)
>              return -1;
>          }
>  
> -        if (xen_pt_setup_vga(s, &s->real_device) < 0) {
> +        xen_pt_setup_vga(s, &s->real_device, &local_err);
> +        if (local_err) {
> +            error_append_hint(&local_err, "Setup VGA BIOS of passthrough"
> +                    " GFX failed!");

Please no '!' in error messages.  We aren't shouting at the user.

>              XEN_PT_ERR(d, "Setup VGA BIOS of passthrough GFX failed!\n");

Do we still need the XEN_PT_ERR() alongside setting the local error?

>              xen_host_pci_device_put(&s->real_device);
>              return -1;

This leaks local_err.


> @@ -172,13 +173,14 @@ int xen_pt_setup_vga(XenPCIPassthroughState *s, 
> XenHostPCIDevice *dev)
>      struct pci_data *pd = NULL;
>  
>      if (!is_igd_vga_passthrough(dev)) {
> -        return -1;
> +        error_setg(errp, "Need to enable igd-passthrough");
> +        return;
>      }
>  
>      bios = get_vgabios(s, &bios_size, dev);
>      if (!bios) {
> -        XEN_PT_ERR(&s->dev, "VGA: Can't getting VBIOS!\n");
> -        return -1;
> +        error_setg(errp, "VGA: Can't getting VBIOS!");
> +        return;

Please drop the trailing '!' while touching this

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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