]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
arch/powerpc/kvm/e500_tlb.c: fix error return code
authorJulia Lawall <julia@diku.dk>
Sat, 4 Aug 2012 23:52:33 +0000 (23:52 +0000)
committerAlexander Graf <agraf@suse.de>
Fri, 5 Oct 2012 21:38:55 +0000 (23:38 +0200)
commit12ecd9570d8941c15602a11725ec9b0ede48d6c2
treee5a73f8d08601a3ef459fcf93a9e6f4ed0cb0611
parent55b665b0263ae88a776071306ef1eee4b769016b
arch/powerpc/kvm/e500_tlb.c: fix error return code

Convert a 0 error return code to a negative one, as returned elsewhere in the
function.

A new label is also added to avoid freeing things that are known to not yet
be allocated.

A simplified version of the semantic match that finds the first problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret;
expression e,e1,e2,e3,e4,x;
@@

(
if (\(ret != 0\|ret < 0\) || ...) { ... return ...; }
|
ret = 0
)
... when != ret = e1
*x = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...);
... when != x = e2
    when != ret = e3
*if (x == NULL || ...)
{
  ... when != ret = e4
*  return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Alexander Graf <agraf@suse.de>
arch/powerpc/kvm/e500_tlb.c