Author: Julia Lawall <julia@diku.dk> An error code is stored in a variable, but 0 is returned instead. Use the variable instead of 0. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ local idexpression x; constant C; @@ if (…) { … x = -C … when != x ( return …
Catégorie : Coccinelle
Aug 16 2010
V4L/DVB: drivers/media: Use available error codes
Author: Julia Lawall <julia@diku.dk> In each case, error codes are stored in rc, but the return value is always 0. Return rc instead. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ local idexpression x; constant C; @@ if (…) { … x = -C … when != x ( return …
Aug 16 2010
V4L/DVB: drivers/media/video/zoran: Use available error codes
Author: Julia Lawall <julia@diku.dk> Error codes are stored in res, but the return value is always 0. Return res instead. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ local idexpression x; constant C; @@ if (…) { … x = -C … when != x ( return ; | return …
Aug 16 2010
drivers/net/wireless/wl12xx: Use available error codes
Author: Julia Lawall <julia@diku.dk> In each case, error codes are stored in ret, but the return value is always 0. Return ret instead. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ local idexpression x; constant C; @@ if (…) { … x = -C … when != x ( return …
Aug 16 2010
drivers/net/qlcnic: Use available error codes
Author: Julia Lawall <julia@diku.dk> The error code is stored in the variable err, but it is the variable ret that is returned instead. So store the error code in ret. Err is then useless. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ local idexpression x; constant C; @@ if (…) …
Aug 16 2010
net/ax25: Use available error codes
Author: Julia Lawall <julia@diku.dk> Error codes are stored in err, but the return value is always 0. Return err instead. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ local idexpression x; constant C; @@ if (…) { … x = -C … when != x ( return ; | return …
Aug 16 2010
net/ax25: Use available error codes
Author: Julia Lawall <julia@diku.dk> Error codes are stored in err, but the return value is always 0. Return err instead. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ local idexpression x; constant C; @@ if (…) { … x = -C … when != x ( return ; | return …
Aug 15 2010
llseek: automatically add .llseek fop
Author: Arnd Bergmann <arnd@arndb.de> All file_operations should get a .llseek operation so we can make nonseekable_open the default for future file operations without a .llseek pointer. The three cases that we can automatically detect are no_llseek, seq_lseek and default_llseek. For cases where we can we can automatically prove that the file offset is always ignored, …
Aug 14 2010
hwmon: (k8temp) Adjust confusing if indentation
Author: Julia Lawall <julia@diku.dk> Move the if(err) statement after the if into the if branch indicated by its indentation. The preceding if(err) test implies that err cannot be nonzero unless the if branch is taken. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r disable braces5@ position p1,p2; statement S1,S2; @@ …
Aug 12 2010
dm crypt: use kstrdup
Author: Julia Lawall <julia@diku.dk> Use kstrdup when the goal of an allocation is copy a string into the allocated region. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression from,to; expression flag,E1,E2; statement S; @@ – to = kmalloc(strlen(from) + 1,flag); + to = kstrdup(from, flag); … when != \(from …