On 10/13/2014 11:31 AM, Jason Wang wrote:
> On 10/10/2014 09:03 PM, Markus Armbruster wrote:
>> Jason Wang <jasow...@redhat.com> writes:
>>
>>> Commit 1ceef9f27359cbe92ef124bf74de6f792e71f6fb (net: multiqueue
>>> support) tries to use set_pointer() and get_pointer() to set and get
>>> NICPeers which is not a pointer defined in DEFINE_PROP_NETDEV. This
>>> trick works but result a unclean and fragile implementation (e.g
>>> print_netdev and parse_netdev).
>>>
>>> This patch solves this issue by not using set/get_pinter() and set and
>>> get netdev directly in set_netdev() and get_netdev(). After this the
>>> parse_netdev() and print_netdev() were no longer used and dropped from
>>> the source.
>>>
>>> Cc: Markus Armbruster <arm...@redhat.com>
>>> Cc: Stefan Hajnoczi <stefa...@redhat.com>
>>> Cc: Peter Maydell <peter.mayd...@linaro.org>
>>> Signed-off-by: Jason Wang <jasow...@redhat.com>
>>> ---
>>> Changes from V1:
>>> - validate ncs pointer before accessing them, this fixes the qtest failure
>>>   on arm.
>>> ---
>>>  hw/core/qdev-properties-system.c | 71 
>>> ++++++++++++++++++++++------------------
>>>  1 file changed, 39 insertions(+), 32 deletions(-)
>>>
>>> diff --git a/hw/core/qdev-properties-system.c 
>>> b/hw/core/qdev-properties-system.c
>>> index ae0900f..6939ea5 100644
>>> --- a/hw/core/qdev-properties-system.c
>>> +++ b/hw/core/qdev-properties-system.c
>>> @@ -176,41 +176,67 @@ PropertyInfo qdev_prop_chr = {
>>>  };
>>>  
[...]
>>>          goto err;
>>>      }
>>>  
>>>      for (i = 0; i < queues; i++) {
>>>          if (peers[i] == NULL) {
>>> -            ret = -ENOENT;
>>> +            err = -ENOENT;
>>>              goto err;
>>>          }
>>>  
>>>          if (peers[i]->peer) {
>>> -            ret = -EEXIST;
>>> +            err = -EEXIST;
>>>              goto err;
>>>          }
>>>  
>>>          if (ncs[i]) {
>>> -            ret = -EINVAL;
>>> +            err = -EINVAL;
>> error_set_from_qdev_prop_error() does not accept -EINVAL, either.
> Ok.

Just have a check, error_set_from_qdev_prop_error() can accept -EINVAL,
so I will only call error_setg() directly for -E2BIG.

Reply via email to