All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cao jin <caoj.fnst@cn.fujitsu.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 1/4] Add Error **errp for xen_host_pci_device_get()
Date: Tue, 5 Jan 2016 13:31:35 +0800	[thread overview]
Message-ID: <568B5537.5060807@cn.fujitsu.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1601041510130.19710@kaball.uk.xensource.com>



On 01/04/2016 11:15 PM, Stefano Stabellini wrote:
> On Sun, 27 Dec 2015, Cao jin wrote:
>> To catch the error msg. Also modify the caller
>>
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>
> This looks much better, thanks.
>
>
[...]
>>
>> -int xen_host_pci_device_get(XenHostPCIDevice *d, uint16_t domain,
>> -                            uint8_t bus, uint8_t dev, uint8_t func)
>> +void xen_host_pci_device_get(XenHostPCIDevice *d, uint16_t domain,
>> +                            uint8_t bus, uint8_t dev, uint8_t func,
>> +                            Error **errp)
>>   {
>>       unsigned int v;
>> -    int rc = 0;
>>
>>       d->config_fd = -1;
>>       d->domain = domain;
>> @@ -353,43 +360,48 @@ int xen_host_pci_device_get(XenHostPCIDevice *d, uint16_t domain,
>>       d->dev = dev;
>>       d->func = func;
>>
>> -    rc = xen_host_pci_config_open(d);
>> -    if (rc) {
>> +    xen_host_pci_config_open(d, errp);
>> +    if (*errp) {
>
> I think that errp could be NULL, therefore the right way to do this is:
>
>      Error *err = NULL;
>      foo(arg, &err);
>      if (err) {
>          handle the error...
>          error_propagate(errp, err);
>      }
>
> see the comment at the beginning of include/qapi/error.h.
>

Thanks for reminding, I didn`t see the comment of error.h before, now I 
am aware why lots of people like the style you mentioned. Will fix it in 
next version, also the comments in other patch.

[...]

-- 
Yours Sincerely,

Cao jin

  reply	other threads:[~2016-01-05  5:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-27 13:40 [Qemu-devel] [PATCH v2 0/4] Convert to realize() Cao jin
2015-12-27 13:40 ` [Qemu-devel] [PATCH v2 1/4] Add Error **errp for xen_host_pci_device_get() Cao jin
2016-01-04 15:15   ` Stefano Stabellini
2016-01-05  5:31     ` Cao jin [this message]
2016-01-05  7:23     ` Cao jin
2016-01-05 10:40       ` Stefano Stabellini
2016-01-05 12:41         ` Cao jin
2015-12-27 13:40 ` [Qemu-devel] [PATCH v2 2/4] Add Error **errp for xen_pt_setup_vga() Cao jin
2016-01-04 15:18   ` Stefano Stabellini
2015-12-27 13:40 ` [Qemu-devel] [PATCH v2 3/4] Add Error **errp for xen_pt_config_init() Cao jin
2016-01-04 15:23   ` Stefano Stabellini
2015-12-27 13:40 ` [Qemu-devel] [PATCH v2 4/4] Xen PCI passthru: convert to realize() Cao jin
2016-01-04 15:29   ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=568B5537.5060807@cn.fujitsu.com \
    --to=caoj.fnst@cn.fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.