From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPLpH-0007Zm-Q0 for qemu-devel@nongnu.org; Wed, 03 Sep 2014 21:27:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPLp8-00049D-PJ for qemu-devel@nongnu.org; Wed, 03 Sep 2014 21:27:03 -0400 Message-ID: <5407C0FD.6060406@gmail.com> Date: Thu, 04 Sep 2014 09:31:41 +0800 From: Chen Gang MIME-Version: 1.0 References: <5405EED9.2090701@gmail.com> <54066F78.7040101@gmail.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] xen-hvm.c: Improve the return method for xen_hvm_init() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefano Stabellini Cc: QEMU Trivial , xen-devel@lists.xensource.com, qemu-devel On 9/4/14 7:32, Stefano Stabellini wrote: > On Wed, 3 Sep 2014, Chen Gang wrote: >> On 9/3/14 0:22, Chen Gang wrote: [...] >>> xen_hvm_init() may also return -errno, which may let upper caller think >>> more (e.g. free some other related resources and try again), although at >>> present, all related upper callers still exit(1). > > I think we should return -1 in the other cases too > [...] >>> @@ -998,6 +999,7 @@ int xen_hvm_init(ram_addr_t *below_4g_mem_size, ram_addr_t *above_4g_mem_size, >>> state->xenstore = xs_daemon_open(); >>> if (state->xenstore == NULL) { >>> perror("xen: xenstore open"); >>> + xc_evtchn_close(state->xce_handle); >>> g_free(state); >>> return -errno; >>> } > > just return -1 and do the same in the above check (xce_handle == > XC_HANDLER_INITIAL_VALUE) > > OK thanks, what you said sounds OK to me. I shall send patch v2 for it within the 2 days (within 2014-09-05). Thanks. -- Chen Gang Open, share, and attitude like air, water, and life which God blessed