[Qemu-devel] [PATCH v2 2/6] pci: Add comment for pci_add_capability2()

Mao Zhongyi posted 6 patches 8 years, 5 months ago
There is a newer version of this series
[Qemu-devel] [PATCH v2 2/6] pci: Add comment for pci_add_capability2()
Posted by Mao Zhongyi 8 years, 5 months ago
Add a comment for pci_add_capability2() to explain the return
value. This may help to make a correct return value check for
its callers.

Cc: mst@redhat.com
Cc: marcel@redhat.com
Cc: armbru@redhat.com
Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
---
 hw/pci/pci.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 53566b8..9810d5f 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2276,6 +2276,10 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
     return ret;
 }
 
+/*
+ * On success, pci_add_capability2() returns a positive value.
+ * On failure, it sets an error and returns a negative value.
+ */
 int pci_add_capability2(PCIDevice *pdev, uint8_t cap_id,
                        uint8_t offset, uint8_t size,
                        Error **errp)
-- 
2.9.3




Re: [Qemu-devel] [PATCH v2 2/6] pci: Add comment for pci_add_capability2()
Posted by Marcel Apfelbaum 8 years, 5 months ago
On 02/06/2017 10:54, Mao Zhongyi wrote:
> Add a comment for pci_add_capability2() to explain the return
> value. This may help to make a correct return value check for
> its callers.
> 
> Cc: mst@redhat.com
> Cc: marcel@redhat.com
> Cc: armbru@redhat.com
> Suggested-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
> ---
>   hw/pci/pci.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 53566b8..9810d5f 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -2276,6 +2276,10 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
>       return ret;
>   }
>   
> +/*
> + * On success, pci_add_capability2() returns a positive value.

Hi,
I would specify what is the return value: the offset of the pci capability.

Thanks,
Marcel

> + * On failure, it sets an error and returns a negative value.
> + */
>   int pci_add_capability2(PCIDevice *pdev, uint8_t cap_id,
>                          uint8_t offset, uint8_t size,
>                          Error **errp)
> 


Re: [Qemu-devel] [PATCH v2 2/6] pci: Add comment for pci_add_capability2()
Posted by Mao Zhongyi 8 years, 5 months ago
Hi, Marcel

On 06/05/2017 09:34 PM, Marcel Apfelbaum wrote:
> On 02/06/2017 10:54, Mao Zhongyi wrote:
>> Add a comment for pci_add_capability2() to explain the return
>> value. This may help to make a correct return value check for
>> its callers.
>>
>> Cc: mst@redhat.com
>> Cc: marcel@redhat.com
>> Cc: armbru@redhat.com
>> Suggested-by: Markus Armbruster <armbru@redhat.com>
>> Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
>> ---
>>   hw/pci/pci.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>> index 53566b8..9810d5f 100644
>> --- a/hw/pci/pci.c
>> +++ b/hw/pci/pci.c
>> @@ -2276,6 +2276,10 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
>>       return ret;
>>   }
>>   +/*
>> + * On success, pci_add_capability2() returns a positive value.
>
> Hi,
> I would specify what is the return value: the offset of the pci capability.
>
> Thanks,
> Marcel
>

Thanks, I will.
Mao

>> + * On failure, it sets an error and returns a negative value.
>> + */
>>   int pci_add_capability2(PCIDevice *pdev, uint8_t cap_id,
>>                          uint8_t offset, uint8_t size,
>>                          Error **errp)
>>
>
>
>
>