From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx2.suse.de", Issuer "CAcert Class 3 Root" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 90B612C00A5 for ; Tue, 2 Oct 2012 21:04:17 +1000 (EST) Subject: Re: [PATCH 3/6] arch/powerpc/kvm/e500_tlb.c: fix error return code Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii From: Alexander Graf In-Reply-To: <1344160356-387-4-git-send-email-Julia.Lawall@lip6.fr> Date: Tue, 2 Oct 2012 13:04:03 +0200 Message-Id: References: <1344160356-387-1-git-send-email-Julia.Lawall@lip6.fr> <1344160356-387-4-git-send-email-Julia.Lawall@lip6.fr> To: Julia Lawall Cc: kvm@vger.kernel.org, Marcelo Tosatti , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, kvm-ppc@vger.kernel.org, Paul Mackerras , Avi Kivity , Julia Lawall , linuxppc-dev@lists.ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 05.08.2012, at 11:52, Julia Lawall wrote: > From: Julia Lawall >=20 > Convert a 0 error return code to a negative one, as returned elsewhere = in the > function. >=20 > A new label is also added to avoid freeing things that are known to = not yet > be allocated. >=20 > A simplified version of the semantic match that finds the first = problem is as > follows: (http://coccinelle.lip6.fr/) >=20 > // > @@ > identifier ret; > expression e,e1,e2,e3,e4,x; > @@ >=20 > ( > if (\(ret !=3D 0\|ret < 0\) || ...) { ... return ...; } > | > ret =3D 0 > ) > ... when !=3D ret =3D e1 > *x =3D = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_= ioremap\|devm_ioremap_nocache\)(...); > ... when !=3D x =3D e2 > when !=3D ret =3D e3 > *if (x =3D=3D NULL || ...) > { > ... when !=3D ret =3D e4 > * return ret; > } > // >=20 > Signed-off-by: Julia Lawall Thanks, applied to kvm-ppc-next. Alex