From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] tools/libxl: Correct use of phyinfo_{init, dispose}() Date: Tue, 4 Aug 2015 22:27:25 +0100 Message-ID: <55C12E3D.4000502@citrix.com> References: <1438714718-23711-1-git-send-email-andrew.cooper3@citrix.com> <20150804212512.GA31528@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20150804212512.GA31528@zion.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: Ian Jackson , Ian Campbell , Xen-devel List-Id: xen-devel@lists.xenproject.org On 04/08/2015 22:25, Wei Liu wrote: > On Tue, Aug 04, 2015 at 07:58:38PM +0100, Andrew Cooper wrote: >> Signed-off-by: Andrew Cooper >> --- > [...] >> index bfc9699..13dc2de 100644 >> --- a/tools/libxl/libxl_utils.c >> +++ b/tools/libxl/libxl_utils.c >> @@ -848,11 +848,10 @@ int libxl__count_physical_sockets(libxl__gc *gc, int *sockets) >> libxl_physinfo_init(&info); >> >> rc = libxl_get_physinfo(CTX, &info); >> - if (rc) >> - return rc; >> - >> - *sockets = info.nr_cpus / info.threads_per_core >> - / info.cores_per_socket; >> + if (!rc) { >> + *sockets = info.nr_cpus / info.threads_per_core >> + / info.cores_per_socket; >> + } >> >> libxl_physinfo_dispose(&info); >> return 0; > This should return rc. Coverity spotted that too. It is fixed in v2 which I havn't posted yet, mainly pending the maintainers decision as to whether this patch is worth persuing for 4.6 or not. ~Andrew