From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 57308A054F; Mon, 15 Mar 2021 16:41:52 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D59914068C; Mon, 15 Mar 2021 16:41:51 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mails.dpdk.org (Postfix) with ESMTP id 60F264068B for ; Mon, 15 Mar 2021 16:41:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615822909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RgNQihG0sWW6wcMxIBDc5DyzRGTEi0u4JUzFThHyeC8=; b=e/DKHlt96LIY6gcdtim8bH8pvA2mfkZiHVYxcKXgJKBRuezPxO7l/UQw9Sf2NVIhU2tid/ F2QRY122g/20ITGe7Ls0YKJSc2tudmQop+nrDASiJTmj2DM7oxH5k8ZwG4o+HiUzyijVrm EjqDBsj0F+pIDrkmDefvYMuUDy9arz8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-428-pKVZpaRjN9mscm7j1m-6_Q-1; Mon, 15 Mar 2021 11:41:48 -0400 X-MC-Unique: pKVZpaRjN9mscm7j1m-6_Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3F9B61932484; Mon, 15 Mar 2021 15:41:46 +0000 (UTC) Received: from [10.36.110.10] (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8F6F410027C4; Mon, 15 Mar 2021 15:41:39 +0000 (UTC) To: David Marchand Cc: dev , "Xia, Chenbo" , Adrian Moreno Zapata , Olivier Matz , bnemeth@redhat.com References: <20210315151957.360530-1-maxime.coquelin@redhat.com> <20210315151957.360530-3-maxime.coquelin@redhat.com> From: Maxime Coquelin Message-ID: <5ff6978e-5b46-5d36-2a3b-6415ce9b9ea2@redhat.com> Date: Mon, 15 Mar 2021 16:41:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 2/4] net/virtio: improve queue init error path X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 3/15/21 4:38 PM, David Marchand wrote: > On Mon, Mar 15, 2021 at 4:20 PM Maxime Coquelin > 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