Category: Linux

ixgb: remove unused variable

Author: Julia Lawall <julia@diku.dk> The variable num_group_tail_writes is initialized but never used otherwise. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ type T; identifier i; constant C; @@ ( extern T i; | – T i; ) // Signed-off-by: Julia Lawall Signed-off-by: Auke Kok Signed-off-by: Jeff Garzik — drivers/net/ixgb/ixgb_main.c | …

Continue reading

[ALSA] sound/pci: remove unused variable

Author: Julia Lawall <julia@diku.dk> The variable is_capture is initialized but never used otherwise. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ type T; identifier i; constant C; @@ ( extern T i; | – T i; ) // Signed-off-by: Julia Lawall Signed-off-by: Takashi Iwai — sound/pci/pcxhr/pcxhr.c | 3 — 1 …

Continue reading

drivers/net/atl1/atl1_main.c: remove unused variable

Author: Julia Lawall <julia@diku.dk> The variable update_rx is initialized but never used otherwise. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ type T; identifier i; constant C; @@ ( extern T i; | – T i; ) // Signed-off-by: Julia Lawall Acked-by: Jay Cliburn Signed-off-by: Jeff Garzik — drivers/net/atl1/atl1_main.c | …

Continue reading

drivers/net/ipg.c: remove unused variable

Author: Julia Lawall <julia@diku.dk> The variable gig is initialized but never used otherwise. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ type T; identifier i; constant C; @@ ( extern T i; | – T i; ) // Signed-off-by: Julia Lawall Signed-off-by: Jeff Garzik — drivers/net/ipg.c | 3 — 1 …

Continue reading

USB: use DIV_ROUND_UP

Author: Julia Lawall <julia@diku.dk> The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) – 1) / (d)) but is perhaps more readable. An extract of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @haskernel@ @@ #include @depends on haskernel@ expression n,d; @@ ( – (n + d – 1) / …

Continue reading

ocfs2: Use BUG_ON

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(); } | …

Continue reading

drivers/net/mv643xx_eth.c: Use FIELD_SIZEOF

Author: Julia Lawall <julia@diku.dk> Robert P.J. Day proposed to use the macro FIELD_SIZEOF in replace of code that matches its definition. The modification was made using the following semantic patch (http://www.emn.fr/x-info/coccinelle/) // @haskernel@ @@ #include @depends on haskernel@ type t; identifier f; @@ – (sizeof(((t*)0)->f)) + FIELD_SIZEOF(t, f) @depends on haskernel@ type t; identifier f; …

Continue reading

sound: Use BUG_ON

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(); } | …

Continue reading

drivers/net/wireless/iwlwifi/iwl-4965.c: correct use of ! and &

Author: Julia Lawall <julia@diku.dk> In commit e6bafba5b4765a5a252f1b8d31cbf6d2459da337, a bug was fixed that involved converting !x & y to !(x & y). The code below shows the same pattern, and thus should perhaps be fixed in the same way. This is not tested and clearly changes the semantics, so it is only something to consider. The …

Continue reading

fs/reiserfs/super.c: correct use of ! and &

Author: Julia Lawall <julia@diku.dk> In commit e6bafba5b4765a5a252f1b8d31cbf6d2459da337 (“wmi: (!x & y) strikes again”), a bug was fixed that involved converting !x & y to !(x & y). The code below shows the same pattern, and thus should perhaps be fixed in the same way. This is not tested and clearly changes the semantics, so it …

Continue reading