Author: Julia Lawall <julia@diku.dk> Delete nontrivial initialization that is immediately overwritten by the result of an allocation function. The semantic match that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; identifier i; expression e; @@ ( T i = \(0\|NULL\|ERR_PTR(…)\); | -T i = e; +T i; ) … when != i …
Category: Linux
Aug 04 2011
drivers/ide/cy82c693.c: Add missing pci_dev_put
Author: Julia Lawall <julia@diku.dk> Pci_get_slot calls pci_dev_get, so pci_dev_put is needed before leaving the function in the case where pci_get_slot is locally used. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ local idexpression x; expression e; @@ *x = pci_get_slot(…) … when != true x == NULL when != pci_dev_put(x) …
Aug 02 2011
arch/tile/mm/init.c: trivial: use BUG_ON
Author: Julia Lawall <julia@diku.dk> Use BUG_ON(x) rather than if(x) BUG(); The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier x; @@ -if (x) BUG(); +BUG_ON(x); @@ identifier x; @@ -if (!x) BUG(); +BUG_ON(!x); // Signed-off-by: Julia Lawall Signed-off-by: Chris Metcalf — arch/tile/mm/init.c | 3 +– 1 file changed, 1 insertion(+), …
Aug 02 2011
arch/openrisc/mm/init.c: trivial: use BUG_ON
Author: Julia Lawall <julia@diku.dk> Use BUG_ON(x) rather than if(x) BUG(); The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier x; @@ -if (x) BUG(); +BUG_ON(x); @@ identifier x; @@ -if (!x) BUG(); +BUG_ON(!x); // Signed-off-by: Julia Lawall Signed-off-by: Jonas Bonn — arch/openrisc/mm/init.c | 3 +– 1 file changed, 1 insertion(+), …
Aug 02 2011
target: Convert target_core_rd.c to use use BUG_ON
Author: Julia Lawall <julia@diku.dk> Use BUG_ON(x) rather than if(x) BUG(); The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier x; @@ -if (x) BUG(); +BUG_ON(x); @@ identifier x; @@ -if (!x) BUG(); +BUG_ON(!x); // Signed-off-by: Julia Lawall Signed-off-by: Nicholas Bellinger — drivers/target/target_core_rd.c | 24 ++++++++—————- 1 file changed, 8 insertions(+), …
Aug 02 2011
KVM: VMX: trivial: use BUG_ON
Author: Julia Lawall <julia@diku.dk> Use BUG_ON(x) rather than if(x) BUG(); The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier x; @@ -if (x) BUG(); +BUG_ON(x); @@ identifier x; @@ -if (!x) BUG(); +BUG_ON(!x); // Signed-off-by: Julia Lawall Signed-off-by: Marcelo Tosatti — arch/x86/kvm/vmx.c | 3 +– 1 file changed, 1 insertion(+), …
Aug 02 2011
target: Use ERR_CAST inlined function
Author: Thomas Meyer <thomas@m3y3r.de> Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(…)) The semantic patch that makes this output is available in scripts/coccinelle/api/err_cast.cocci. More information about semantic patching is available at http://coccinelle.lip6.fr/ Signed-off-by: Thomas Meyer Signed-off-by: Nicholas Bellinger — drivers/target/iscsi/iscsi_target_configfs.c | 4 ++– drivers/target/target_core_fabric_configfs.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff …
Jul 29 2011
frv: remove unnecessary code
Author: Greg Dietsche <Gregory.Dietsche@cuw.edu> remove unnecessary code that matches this coccinelle pattern if (…) return ret; return ret; Signed-off-by: Greg Dietsche Signed-off-by: David Howells Signed-off-by: Linus Torvalds — arch/frv/mm/pgalloc.c | 8 +——- 1 file changed, 1 insertion(+), 7 deletions(-) diff –git a/arch/frv/mm/pgalloc.c b/arch/frv/mm/pgalloc.c index c42c83d..4fb63a3 100644 — a/arch/frv/mm/pgalloc.c +++ b/arch/frv/mm/pgalloc.c @@ -133,13 +133,7 @@ …
Jul 28 2011
ALSA: sound/core/pcm_compat.c: adjust array index
Author: Julia Lawall <julia@diku.dk> Convert array index from the loop bound to the loop index. A simplified version of the semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression e1,e2,ar; @@ for(e1 = 0; e1 < e2; e1++) { } // Signed-off-by: Julia Lawall Cc: Signed-off-by: Takashi Iwai --- sound/core/pcm_compat.c | …
Jul 28 2011
drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c: adjust array index
Author: Julia Lawall <julia@diku.dk> Convert array index from the loop bound to the loop index. A simplified version of the semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression e1,e2,ar; @@ for(e1 = 0; e1 < e2; e1++) { } // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c | 2 …