Received: from eggs.gnu.org ([208.118.235.92]:50865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlMpo-0006Gw-E1 for qemu-devel@nongnu.org; Wed, 19 Dec 2012 11:49:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TlMpk-0004qt-3p for qemu-devel@nongnu.org; Wed, 19 Dec 2012 11:49:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22792) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlMpj-0004qc-T4 for qemu-devel@nongnu.org; Wed, 19 Dec 2012 11:49:28 -0500 Date: Wed, 19 Dec 2012 17:49:22 +0100 From: Igor Mammedov Message-ID: <20121219174922.693a45a4@nial.usersys.redhat.com> In-Reply-To: <20121219163628.GJ5334@otherpad.lan.raisama.net> References: <1355760092-18755-8-git-send-email-imammedo@redhat.com> <1355848243-25704-1-git-send-email-imammedo@redhat.com> <20121219163628.GJ5334@otherpad.lan.raisama.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 07/20 v2] target-i386: cpu_x86_register() consolidate freeing resources List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: qemu-devel@nongnu.org, afaerber@suse.de On Wed, 19 Dec 2012 14:36:28 -0200 Eduardo Habkost wrote: > On Tue, Dec 18, 2012 at 05:30:43PM +0100, Igor Mammedov wrote: > > freeing resources in one place would require setting 'error' > > to not NULL, so add some more error reporting before jumping to > > exit branch. > > > > Signed-off-by: Igor Mammedov > > --- > > v2: > > - add missing 'return -1' on exit if error is not NULL, > > Spotted-By: Eduardo Habkost > > --- > > target-i386/cpu.c | 17 ++++++++--------- > > 1 files changed, 8 insertions(+), 9 deletions(-) > > > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > > index 3b9bbfe..fe8b76c 100644 > > --- a/target-i386/cpu.c > > +++ b/target-i386/cpu.c > > @@ -1550,13 +1550,14 @@ int cpu_x86_register(X86CPU *cpu, const char > > *cpu_model) > > model_pieces = g_strsplit(cpu_model, ",", 2); > > if (!model_pieces[0]) { > > - goto error; > > + goto out; > > Missing error_set*() call here. Thinking about this error path, it looks like it's unreachable, because of every caller of cpu_init() passes in not empty cpu_model. Perhaps it would make sense to just assert(cpu_model) at the beginning of function and delete this error check. > > The rest of the patch looks good, to me. I liked this style of handling > errors & freeing resources. > > [snip]