drivers/gpu/drm/nouveau/nouveau_grctx.c: correct NULL test

Author: Julia Lawall <julia@diku.dk> Test the just-allocated value for NULL rather than some other value. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x,y; statement S; @@ x = \(kmalloc\|kcalloc\|kzalloc\)(…); ( if ((x) == NULL) S | if ( – y + x == NULL) S ) // Signed-off-by: …

Continue reading

kernel/cred.c: use kmem_cache_free

Author: Julia Lawall <julia@diku.dk> Free memory allocated using kmem_cache_zalloc using kmem_cache_free rather than kfree. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x,E,c; @@ x = \(kmem_cache_alloc\|kmem_cache_zalloc\|kmem_cache_alloc_node\)(c,…) … when != x = E when != &x ?-kfree(x) +kmem_cache_free(c,x) // Signed-off-by: Julia Lawall Acked-by: David Howells Cc: James Morris Cc: …

Continue reading

net/sctp: Eliminate useless code

Author: Julia Lawall <julia@diku.dk> The variable newinet is initialized twice to the same (side effect-free) expression. Drop one initialization. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // @forall@ idexpression *x; identifier f!=ERR_PTR; @@ x = f(…) … when != x ( x = f(…,,…) | * x = f(…) …

Continue reading

ceph: remove duplicate variable initialization

Author: Julia Lawall <julia@diku.dk> The variable client is initialized twice to the same (side effect-free) expression. Drop one initialization. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // @forall@ idexpression *x; identifier f!=ERR_PTR; @@ x = f(…) … when != x ( x = f(…,,…) | * x = f(…) …

Continue reading

spi: make Open Firmware device id constant

Author: Márton Németh <nm127@freemail.hu> The match_table field of the struct of_device_id is constant in so it is worth to make the initialization data constant. The semantic match that finds this kind of pattern is as follows: (http://coccinelle.lip6.fr/) // @r@ disable decl_init,const_decl_init; identifier I1, I2, x; @@ struct I1 { … const struct I2 *x; … …

Continue reading

drivers/net: Eliminate useless code

Author: Julia Lawall <julia@diku.dk> The variable qdev is initialized twice to the same (side effect-free) expression. Drop one initialization. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // @forall@ idexpression *x; identifier f!=ERR_PTR; @@ x = f(…) … when != x ( x = f(…,,…) | * x = f(…) …

Continue reading

crypto: Make Open Firmware device id constant

Author: Márton Németh <nm127@freemail.hu> From: Márton Németh The match_table field of the struct of_device_id is constant in so it is worth to make the initialization data also constant. The semantic match that finds this kind of pattern is as follows: (http://coccinelle.lip6.fr/) // @r@ disable decl_init,const_decl_init; identifier I1, I2, x; @@ struct I1 { … const …

Continue reading

ecryptfs: Eliminate useless code

Author: Julia Lawall <julia@diku.dk> The variable lower_dentry is initialized twice to the same (side effect-free) expression. Drop one initialization. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // @forall@ idexpression *x; identifier f!=ERR_PTR; @@ x = f(…) … when != x ( x = f(…,,…) | * x = f(…) …

Continue reading

USB: serial: Eliminate useless code

Author: Julia Lawall <julia@diku.dk> The variables priv and portdata are initialized twice to the same (side effect-free) expressions. Drop one initialization in each case. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // @forall@ idexpression *x; identifier f!=ERR_PTR; @@ x = f(…) … when != x ( x = f(…,,…) …

Continue reading

Staging: go7007: Eliminate useless code

Author: Julia Lawall <julia@diku.dk> The variable s is initialized twice to the same (side effect-free) expression. Drop one initialization. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // @forall@ idexpression *x; identifier f!=ERR_PTR; @@ x = f(…) … when != x ( x = f(…,,…) | * x = f(…) …

Continue reading