Author: Julia Lawall <Julia.Lawall@lip6.fr> Dma_pool_zalloc combines dma_pool_alloc and memset 0. The semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // @@ expression d,e; statement S; @@ d = – dma_pool_alloc + dma_pool_zalloc (…); if (!d) S – memset(d, 0, sizeof(*d)); // Signed-off-by: Julia Lawall Signed-off-by: Vinod Koul — drivers/dma/mmp_pdma.c | 3 +– 1 …
Catégorie : Coccinelle
Apr 28 2016
perf tests: Do not use sizeof on pointer type
Author: Vaishali Thakkar <vaishali.thakkar@oracle.com> Using sizeof on a malloced pointer type will return the wordsize which can often cause one to allocate a buffer much smaller than it is needed. So, here do not use sizeof on pointer type. Note that this has no effect on runtime because ‘dsos’ is a pointer to a pointer. …
Apr 28 2016
clk: bcm/kona: Do not use sizeof on pointer type
Author: Vaishali Thakkar <vaishali.thakkar@oracle.com> When sizeof is applied to a pointer typed expression, it gives the size of the pointer. So, here do not use sizeof on pointer type. Also, silent checkpatch.pl by using kmalloc_array over kmalloc. Note that this has no effect on runtime because ‘parent_names’ is a pointer to a pointer. Problem found …
Apr 28 2016
drm/msm: Move call to PTR_ERR_OR_ZERO after reassignment
Author: Vaishali Thakkar <vaishali.thakkar@oracle.com> Here, a location is reset to NULL before being passed to PTR_ERR. So, PTR_ERR should be called before its argument is reassigned to NULL. Further to simplify things use PTR_ERR_OR_ZERO instead of PTR_ERR and IS_ERR. Problem found using Coccinelle. Signed-off-by: Vaishali Thakkar Reviewed-by: Eric Engestrom [fixed fmt string warning (s/%ld/%d/)] Signed-off-by: …
Apr 23 2016
net: tsi108: use NULL for pointer-typed argument
Author: Julia Lawall <julia.lawall@lip6.fr> The first argument of pci_free_consistent has type struct pci_dev *, so use NULL instead of 0. The semantic patch that performs this transformation is as follows: (http://coccinelle.lip6.fr/) // @@ @@ pci_free_consistent( – 0 + NULL , …) // Signed-off-by: Julia Lawall Signed-off-by: David S. Miller — drivers/net/ethernet/tundra/tsi108_eth.c | 3 ++- 1 …
Apr 21 2016
thermal: fix ptr_ret.cocci warnings
Author: kbuild test robot <fengguang.wu@intel.com> drivers/thermal/tango_thermal.c:86:1-3: WARNING: PTR_ERR_OR_ZERO can be used Use PTR_ERR_OR_ZERO rather than if(IS_ERR(…)) + PTR_ERR Generated by: scripts/coccinelle/api/ptr_ret.cocci CC: Marc Gonzalez Signed-off-by: Fengguang Wu Signed-off-by: Eduardo Valentin — drivers/thermal/tango_thermal.c | 5 +—- 1 file changed, 1 insertion(+), 4 deletions(-) diff –git a/drivers/thermal/tango_thermal.c b/drivers/thermal/tango_thermal.c index d6592bf..22f9b1e 100644 — a/drivers/thermal/tango_thermal.c +++ b/drivers/thermal/tango_thermal.c @@ …
Apr 19 2016
mtd: nandsim: add __init attribute
Author: Julia Lawall <julia.lawall@lip6.fr> Add __init attribute on functions that are only called from other __init functions and that are not inlined, at least with gcc version 4.8.4 on an x86 machine with allyesconfig. Currently, the functions are put in the .text.unlikely segment. Declaring them as __init will cause them to be put in the …
Apr 19 2016
mtd: pmc551: add __init attribute
Author: Julia Lawall <julia.lawall@lip6.fr> Add __init attribute on a function that is only called from other __init functions and that is not inlined, at least with gcc version 4.8.4 on an x86 machine with allyesconfig. Currently, the function is put in the .text.unlikely segment. Declaring it as __init will cause it to be put in …
Apr 19 2016
mtd: maps: add __init attribute
Author: Julia Lawall <julia.lawall@lip6.fr> Add __init attribute on functions that are only called from other __init functions and that are not inlined, at least with gcc version 4.8.4 on an x86 machine with allyesconfig. Currently, the functions are put in the .text.unlikely segment. Declaring them as __init will cause them to be put in the …
Apr 19 2016
thermal: of: add __init attribute
Author: Julia Lawall <Julia.Lawall@lip6.fr> Add __init attribute on a function that is only called from other __init functions and that is not inlined, at least with gcc version 4.8.4 on an x86 machine with allyesconfig. Currently, the function is put in the .text.unlikely segment. Declaring it as __init will cause it to be put in …