drivers/misc/iwmc3200top/main.c: eliminate useless code

Author: Julia Lawall <julia@diku.dk> The variable priv 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(…) …

Lire la suite

i2c: Make PCI device ids constant

Author: Márton Németh <nm127@freemail.hu> The id_table field of the struct pci_driver is constant in so it is worth to make 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 struct I2 *x; … …

Lire la suite

V4L/DVB: drivers/staging/tm6000/tm6000-video.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: …

Lire la suite

drivers/net: Correct NULL test

Author: Julia Lawall <julia@diku.dk> Test the value that was just allocated rather than the previously tested one. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ expression *x; expression e; identifier l; @@ if (x == NULL || …) { … when forall return …; } … …

Lire la suite

fs/xfs: Correct NULL test

Author: Julia Lawall <julia@diku.dk> Test the value that was just allocated rather than the previously tested one. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ expression *x; expression e; identifier l; @@ if (x == NULL || …) { … when forall return …; } … …

Lire la suite

V4L/DVB: drivers/media: Correct NULL test

Author: Julia Lawall <julia@diku.dk> In each case, the NULL test has been performed already. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ expression *x; expression e; identifier l; @@ if (x == NULL || …) { … when forall return …; } … when != goto …

Lire la suite

drivers/dma: Correct NULL test

Author: Julia Lawall <julia@diku.dk> cohd_fin has already been verified not to be NULL, so the argument to BUG_ON cannot be true. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ expression *x; expression e; identifier l; @@ if (x == NULL || …) { … when forall …

Lire la suite

KVM: VMX: Remove redundant test in vmx_set_efer()

Author: Julia Lawall <julia@diku.dk> msr was tested above, so the second test is not needed. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ expression *x; expression e; identifier l; @@ if (x == NULL || …) { … when forall return …; } … when != …

Lire la suite

MIPS: SNI: Correct NULL test

Author: Julia Lawall <julia@diku.dk> Test the value that was just allocated rather than the previously tested one. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ expression *x; expression e; identifier l; @@ if (x == NULL || …) { … when forall return …; } … …

Lire la suite

dma: 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 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 struct I2 *x; …

Lire la suite