From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chen Gang Subject: Re: [PATCH] xen-hvm.c: Improve the return method for xen_hvm_init() Date: Thu, 04 Sep 2014 09:31:41 +0800 Message-ID: <5407C0FD.6060406@gmail.com> References: <5405EED9.2090701@gmail.com> <54066F78.7040101@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org To: Stefano Stabellini Cc: QEMU Trivial , xen-devel@lists.xensource.com, qemu-devel List-Id: xen-devel@lists.xenproject.org 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