]> bbs.cooldavid.org Git - net-next-2.6.git/commit
staging: tidspbridge: Clean up error-handling code
authorJulia Lawall <julia@diku.dk>
Fri, 15 Oct 2010 13:00:10 +0000 (15:00 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 15 Oct 2010 19:44:25 +0000 (12:44 -0700)
commitcc58cbb88569e3ecb9786b3da891e7d019d2cfff
treea9cf0bbafc40044f6e562d926f35b0b98adfd64e
parentaaf0885c30449d7b40d7cb5b07d6ff64b419c0d1
staging: tidspbridge: Clean up error-handling code

In the first hunk, 0 is returned on memory allocation failure, even though
other failures return -ENOMEM or other similar values.

In the second hunk, there was error handling code that returned without
freeing psz_path_name.

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

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

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

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/tidspbridge/pmgr/dspapi.c