From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFLjW-0006qV-Kx for qemu-devel@nongnu.org; Tue, 12 Mar 2013 05:43:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFLjQ-0006I1-Ds for qemu-devel@nongnu.org; Tue, 12 Mar 2013 05:42:58 -0400 Message-ID: <513EF871.70409@suse.de> Date: Tue, 12 Mar 2013 10:42:09 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1362679963-23201-1-git-send-email-imammedo@redhat.com> In-Reply-To: <1362679963-23201-1-git-send-email-imammedo@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] fix qemu_get_cpu(), should return NULL if CPU not found List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-ppc , qemu-devel@nongnu.org, Alexander Graf Am 07.03.2013 19:12, schrieb Igor Mammedov: > commit 55e5c2850 breaks CPU not found return value, and returns > CPU corresponding to the last non NULL env. > Fix it by returning CPU only if env is not NULL, otherwise CPU is > not found and function should return NULL. >=20 > Signed-off-by: Igor Mammedov D'oh, that was exactly the problem in ppc code I tried to fix by using this function! ;-) Thanks, applied to qom-cpu (with modified commit message): https://github.com/afaerber/qemu-cpu/commits/qom-cpu Pull coming up. Andreas > --- > exec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/exec.c b/exec.c > index 46a2830..0a96ddb 100644 > --- a/exec.c > +++ b/exec.c > @@ -260,7 +260,7 @@ CPUState *qemu_get_cpu(int index) > env =3D env->next_cpu; > } > =20 > - return cpu; > + return env ? cpu : NULL; > } > =20 > void cpu_exec_init(CPUArchState *env) >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg