Author: Julia Lawall <julia@diku.dk> The mutex is released on a successful return, so it would seem that it should be released on an error return as well. The semantic patch finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ expression l; @@ mutex_lock(l); … when != mutex_unlock(l) when any when strict ( if (…) { …
Category: Linux
Jul 21 2008
drivers/net/ehea/ehea_main.c: Release mutex in error handling code
Author: Julia Lawall <julia@diku.dk> The mutex is released on a successful return, so it would seem that it should be released on an error return as well. The semantic patch finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ expression l; @@ mutex_lock(l); … when != mutex_unlock(l) when any when strict ( if (…) { …
Jul 17 2008
arch/m68k/mm/sun3mmu.c: Eliminate NULL test and memset after alloc_bootmem
Author: Julia Lawall <julia@diku.dk> As noted by Akinobu Mita in patch b1fceac2b9e04d278316b2faddf276015fc06e3b, alloc_bootmem and related functions never return NULL and always return a zeroed region of memory. Thus a NULL test or memset after calls to these functions is unnecessary. This was fixed using the following semantic patch. (http://www.emn.fr/x-info/coccinelle/) // @@ expression E; statement S; …
Jul 17 2008
arch/m68k/mm/motorola.c: Eliminate NULL test and memset after alloc_bootmem
Author: Julia Lawall <julia@diku.dk> As noted by Akinobu Mita in patch b1fceac2b9e04d278316b2faddf276015fc06e3b, alloc_bootmem and related functions never return NULL and always return a zeroed region of memory. Thus a NULL test or memset after calls to these functions is unnecessary. This was fixed using the following semantic patch. (http://www.emn.fr/x-info/coccinelle/) // @@ expression E; statement S; …
Jul 16 2008
drivers/usb/class/usblp.c: adjust error handling code
Author: Julia Lawall <julia@diku.dk> In this code, it is possible to tell statically whether usblp will be NULL in the error handling code. Oliver Neukum suggested to make a goto to the final return rather than return directly. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ identifier f,err,l,l1; type T; …
Jul 16 2008
net/ieee80211: adjust error handling
Author: Julia Lawall <julia@diku.dk> Converts a test in error handling code to a sequence of labels. The semantic match that found the problem is: (http://www.emn.fr/x-info/coccinelle/) // @@ expression E,E1,E2; @@ E = alloc_etherdev(…) … when != E = E1 if (…) { … free_netdev(E); … return …; } … when != E = E2 ( …
Jul 14 2008
[S390] drivers/s390: Eliminate NULL test and memset after alloc_bootmem
Author: Julia Lawall <julia@diku.dk> As noted by Akinobu Mita in patch b1fceac2b9e04d278316b2faddf276015fc06e3b, alloc_bootmem and related functions never return NULL and always return a zeroed region of memory. Thus a NULL test or memset after calls to these functions is unnecessary. drivers/s390/char/raw3270.c | 11 +———- drivers/s390/char/sclp_con.c | 2 — 2 files changed, 1 insertion(+), 12 deletions(-) …
Jul 14 2008
[S390] arch/s390: Eliminate NULL test and memset after alloc_bootmem
Author: Julia Lawall <julia@diku.dk> As noted by Akinobu Mita in patch b1fceac2b9e04d278316b2faddf276015fc06e3b, alloc_bootmem and related functions never return NULL and always return a zeroed region of memory. Thus a NULL test or memset after calls to these functions is unnecessary. arch/s390/kernel/topology.c | 2 — 1 file changed, 2 deletions(-) This was fixed using the following …
Jul 12 2008
ext4: Use BUG_ON() instead of BUG()
Author: Julia Lawall <julia@diku.dk> if (…) BUG(); should be replaced with BUG_ON(…) when the test has no side-effects to allow a definition of BUG_ON that drops the code completely. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @ disable unlikely @ expression E,f; @@ ( if () { BUG(); } | …
Jun 30 2008
It looks at least odd to apply spin_unlock to a mutex.
Author: Julia Lawall <julia@diku.dk> The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @def@ declarer DEFINE_MUTEX; identifier m; @@ DEFINE_MUTEX(m); @@ identifier def.m; @@ ( – spin_lock(&m) + mutex_lock(&m) | – spin_unlock(&m) + mutex_unlock(&m) ) // Signed-off-by: Julia Lawall Signed-off-by: Jesper Nilsson — arch/cris/arch-v10/drivers/pcf8563.c | 2 +- arch/cris/arch-v32/drivers/pcf8563.c | 2 +- 2 …