Category: Linux

[SCSI] pm8001: Use kzalloc for allocating only one thing

Author: Julia Lawall <julia@diku.dk> Use kzalloc rather than kcalloc(1,…) The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ @@ – kcalloc(1, + kzalloc( …) // Signed-off-by: Julia Lawall Acked-by:Jack Wang Signed-off-by: James Bottomley — drivers/scsi/pm8001/pm8001_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)   diff –git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index …

Continue reading

drivers/gpu: Use kzalloc for allocating only one thing

Author: Julia Lawall <julia@diku.dk> Use kzalloc rather than kcalloc(1,…) The use of the allocated memory that looks like an array is &p->relocs[0], but this should be the same as p->relocs. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ @@ – kcalloc(1, + kzalloc( …) // Signed-off-by: Julia Lawall Signed-off-by: Dave …

Continue reading

drivers/net/cxgb3: Use kzalloc for allocating only one thing

Author: Julia Lawall <julia@diku.dk> Use kzalloc rather than kcalloc(1,…) The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ @@ – kcalloc(1, + kzalloc( …) // Signed-off-by: Julia Lawall Acked-by: Divy Le Ray Signed-off-by: David S. Miller — drivers/net/cxgb3/cxgb3_offload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)   diff –git …

Continue reading

[S390] drivers: Correct size given to memset

Author: Julia Lawall <julia@diku.dk> Memset should be given the size of the structure, not the size of the pointer. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; T *x; expression E; @@ memset(x, E, sizeof( + * x)) // Signed-off-by: Julia Lawall Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky …

Continue reading

drivers/video/via/viafbdev.c: correct code taking the size of a pointer

Author: Julia Lawall <julia@diku.dk> sizeof(viafb_gamma_table) is just the size of the pointer. This is changed to the size used when calling kmalloc to initialize the pointer. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression *x; expression f; type T; @@ *f(…,(T)x,…) // Signed-off-by: Julia Lawall …

Continue reading

drivers/video: Move dereference after NULL test

Author: Julia Lawall <julia@diku.dk> If the NULL test on fbi is needed, then the dereference should be after the NULL test. A simplified version of the semantic match that detects this problem is as follows (http://coccinelle.lip6.fr/): // @match exists@ expression x, E; identifier fld; @@ * x->fld … when != \(x = E\|&x\) * x …

Continue reading

drivers/mmc: Move dereference after NULL test

Author: Julia Lawall <julia@diku.dk> If the NULL test on mrq is needed, then the derefernce should be after the NULL test. A simplified version of the semantic match that detects this problem is as follows (http://coccinelle.lip6.fr/): // @match exists@ expression x, E; identifier fld; @@ * x->fld … when != \(x = E\|&x\) * x …

Continue reading

tree-wide: convert open calls to remove spaces to skip_spaces() lib function

Author: AndrĂ© Goddard Rosa <andre.goddard@gmail.com> Makes use of skip_spaces() defined in lib/string.c for removing leading spaces from strings all over the tree. It decreases lib.a code size by 47 bytes and reuses the function tree-wide: text data bss dec hex filename 64688 584 592 65864 10148 (TOTALS-BEFORE) 64641 584 592 65817 10119 (TOTALS-AFTER) Also, while …

Continue reading

drivers/cpuidle: Move dereference after NULL test

Author: Julia Lawall <julia@diku.dk> It does not seem possible that ldev can be NULL, so drop the unnecessary test. If ldev can somehow be NULL, then the initialization of last_idx should be moved below the test. A simplified version of the semantic match that detects this problem is as follows (http://coccinelle.lip6.fr/): // @match exists@ expression …

Continue reading

drivers/net/wireless: Correct code taking the size of a pointer

Author: Julia Lawall <julia@diku.dk> sizeof(iv16) and sizeof(iv32) are the sizes of pointers. Change them to the size of the copied data. Furthermore, iveiv_entry is a local structure that has just been initialized and is not visible outside this function. Thus, there would seem to be no point to copy data into it. The order of …

Continue reading