On 02/01/2015 15:06, Stefan Hajnoczi wrote:
> On Tue, Dec 23, 2014 at 05:53:20PM +0100, Paolo Bonzini wrote:
>> @@ -324,6 +324,8 @@ void qemu_del_net_client(NetClientState *nc)
>>      NetClientState *ncs[MAX_QUEUE_NUM];
>>      int queues, i;
>>  
>> +    assert(nc->info->type != NET_CLIENT_OPTIONS_KIND_NIC);
>> +
>>      /* If the NetClientState belongs to a multiqueue backend, we will 
>> change all
>>       * other NetClientStates also.
>>       */
>> @@ -355,8 +357,6 @@ void qemu_del_net_client(NetClientState *nc)
>>          return;
>>      }
>>  
>> -    assert(nc->info->type != NET_CLIENT_OPTIONS_KIND_NIC);
>> -
>>      for (i = 0; i < queues; i++) {
>>          qemu_cleanup_net_client(ncs[i]);
>>          qemu_free_net_client(ncs[i]);
> 
> The assert can be dropped completely since the code already has an
> equivalent assert:
> 
>   queues = qemu_find_net_clients_except(nc->name, ncs,
>                                         NET_CLIENT_OPTIONS_KIND_NIC,
>                                         MAX_QUEUE_NUM);
>   assert(queues != 0); <-- fail if type == NET_CLIENT_OPTIONS_KIND_NIC
I left it on purpose for documentation, but I'll send v2 next week that
removes it.

Paolo

Reply via email to