[dpdk-dev] [PATCH v2 2/4] net/virtio: improve queue init error path

Maxime Coquelin maxime.coquelin at redhat.com
Mon Mar 15 16:41:37 CET 2021



On 3/15/21 4:38 PM, David Marchand wrote:
> On Mon, Mar 15, 2021 at 4:20 PM Maxime Coquelin
> <maxime.coquelin at redhat.com> wrote:
>> @@ -604,15 +604,22 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t queue_idx)
>>
>>         if (VIRTIO_OPS(hw)->setup_queue(hw, vq) < 0) {
>>                 PMD_INIT_LOG(ERR, "setup_queue failed");
>> -               return -EINVAL;
>> +               ret = -EINVAL;
>> +               goto clean_vq;
>>         }
>>
>>         return 0;
>>
>> -fail_q_alloc:
>> -       rte_free(sw_ring);
>> +clean_vq:
>> +       hw->cvq = NULL;
>> +
>> +       if (sw_ring)
>> +               rte_free(sw_ring);
> 
> Nit: rte_free handles NULL fine, you can remove the test, the same way
> it was done before.

The API doc indeed specifies the NULL case, I'll remove it in v3.

>> +free_hdr_mz:
>>         rte_memzone_free(hdr_mz);
>> +free_mz:
>>         rte_memzone_free(mz);
>> +free_vq:
>>         rte_free(vq);
>>
>>         return ret;
> 

Thanks,
Maxime



More information about the dev mailing list