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 F412742BEF; Wed, 31 May 2023 14:48:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E268040A89; Wed, 31 May 2023 14:48:17 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 52E8B40A82 for ; Wed, 31 May 2023 14:48:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685537295; 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=7uYf4xB0KBcF9mQoXEVJTdaw9JtJFh1aKWlDqtoAspA=; b=EiCA3PcT06Utzb+Cps6H//v+FH2hHG6X1DvsFAHEK/V+oBkcv3XPohjebR4eFuArRpPFCf YEu8zkJrsRLd5aEbZ2L7ef/dblsP3qmR9bcSygJPcOhldkWZx8YSp/mCyXRF1IA+PBSy9L tAqdDPrGr9leEgqtPC4kHO/DVp0Bc98= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-550-88ipJNpAOxiIlgMfnJVMww-1; Wed, 31 May 2023 08:48:12 -0400 X-MC-Unique: 88ipJNpAOxiIlgMfnJVMww-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4595D80331C; Wed, 31 May 2023 12:48:12 +0000 (UTC) Received: from [10.39.208.19] (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66E03112132C; Wed, 31 May 2023 12:48:11 +0000 (UTC) Message-ID: <92de0a57-d3ce-b37e-91d4-7ed87dc05fff@redhat.com> Date: Wed, 31 May 2023 14:48:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v3 4/4] vhost: add device op to offload the interrupt kick To: David Marchand , Eelco Chaudron Cc: chenbo.xia@intel.com, dev@dpdk.org References: <168431450017.558450.16680518469610688737.stgit@ebuild.local> <168431455219.558450.14986601389394385835.stgit@ebuild.local> From: Maxime Coquelin In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 On 5/31/23 14:01, David Marchand wrote: > Eelco, Maxime, > > On Wed, May 17, 2023 at 11:09 AM Eelco Chaudron wrote: >> @@ -846,6 +848,11 @@ vhost_user_socket_mem_free(struct vhost_user_socket *vsocket) >> vsocket->path = NULL; >> } >> >> + if (vsocket && vsocket->malloc_notify_ops) { >> + free(vsocket->malloc_notify_ops); >> + vsocket->malloc_notify_ops = NULL; >> + } >> + >> if (vsocket) { >> free(vsocket); >> vsocket = NULL; > > Nit: we had several cleanups in the tree to remove patterns like if > (ptr) free(ptr). > Here, this helper could look for vsocket being NULL first thing, then > call free() unconditionnally. > And resetting the fields to NULL is probably not that useful, since > the vsocket is freed at the end. > Wdyt of: > > static void > vhost_user_socket_mem_free(struct vhost_user_socket *vsocket) > { > if (vsocket == NULL) > return; > > free(vsocket->path); > free(vsocket->malloc_notify_ops); > free(vsocket); > } > > It is indeed better, I can fix while applying if Eelco agrees. Thanks, Maxime