[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 15/17] vfio/pci: Remove vfio_msix_early_setup
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v4 15/17] vfio/pci: Remove vfio_msix_early_setup returned value |
Date: |
Fri, 07 Oct 2016 09:15:15 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Auger Eric <address@hidden> writes:
> Hi Markus,
>
> On 04/10/2016 15:05, Markus Armbruster wrote:
>> Eric Auger <address@hidden> writes:
>>
>>> The returned value is not used anymore by the caller, vfio_realize,
>>> since the error now is stored in the error object. So let's remove it.
>>>
>>> Signed-off-by: Eric Auger <address@hidden>
>>>
>>> ---
>>>
>>> Logically we could do that job for all the functions now getting an
>>> Error object passed as a parameter to avoid duplicate information
>>> between the error content and the returned value. This requires to use
>>> a local error object in vfio_realize. So I am not sure this is worth
>>> the candle.
>>
>> Matter of taste, yours is fine.
>>
>> We used to recommend returing void instead of an error code when the
>> function sets and error. More parsimonious in theory, more boiler-plate
>> in practice, so we accept either now. Perhaps we should even recommend
>> returning an error code, but such a recommendation needs to come with
>> patches converting existing code to it.
>
> The risk is that if a programmer returns an error value without setting
> the errp he will get a sigsev on subsequent error_prepend().
Yes, the function contract becomes more complex, giving the programmer
another way to screw up. Besides crashing, callers might also detect
success as failure, failure as success, and leak error objects.
I don't particularly like setting such traps, but:
1. the risk already exists for functions returning a distinct value on
failure, e.g. null on failure and non-null on success, and
2. I've gotten really tired of the extra error-checking boiler-plate
necessary for functions returning void.
[...]
- [Qemu-devel] [PATCH v4 06/17] vfio/pci: Pass an error object to vfio_add_capabilities, (continued)
- [Qemu-devel] [PATCH v4 06/17] vfio/pci: Pass an error object to vfio_add_capabilities, Eric Auger, 2016/10/03
- [Qemu-devel] [PATCH v4 09/17] vfio: Pass an error object to vfio_get_group, Eric Auger, 2016/10/03
- [Qemu-devel] [PATCH v4 10/17] vfio: Pass an error object to vfio_get_device, Eric Auger, 2016/10/03
- [Qemu-devel] [PATCH v4 11/17] vfio/platform: Pass an error object to vfio_populate_device, Eric Auger, 2016/10/03
- [Qemu-devel] [PATCH v4 12/17] vfio/platform: fix a wrong returned value in vfio_populate_device, Eric Auger, 2016/10/03
- [Qemu-devel] [PATCH v4 15/17] vfio/pci: Remove vfio_msix_early_setup returned value, Eric Auger, 2016/10/03
- [Qemu-devel] [PATCH v4 14/17] vfio/pci: Conversion to realize, Eric Auger, 2016/10/03
- [Qemu-devel] [PATCH v4 16/17] vfio/pci: Remove vfio_populate_device returned value, Eric Auger, 2016/10/03
- [Qemu-devel] [PATCH v4 13/17] vfio/platform: Pass an error object to vfio_base_device_init, Eric Auger, 2016/10/03
- [Qemu-devel] [PATCH v4 17/17] vfio/pci: Handle host oversight, Eric Auger, 2016/10/03
- Re: [Qemu-devel] [PATCH v4 00/17] Convert VFIO-PCI to realize, Markus Armbruster, 2016/10/04