Category: Coccinelle

Staging: rtl8723au: Clean up tests if NULL returned on failure

Author: Bhumika Goyal <bhumirks@gmail.com> Some functions like kmalloc/usb_alloc_urb returns Null as their return value on failure. !x is generally preferred over x==NULL or NULL==x. So make use of !x if the value returned on failure by these functions is NULL. Done using coccinelle: @@ expression e; statement S; @@ e = \(kmalloc\|devm_kzalloc\|kmalloc_array \|devm_ioremap\|usb_alloc_urb\|alloc_netdev\)(…); – if(e==NULL) …

Continue reading

Staging: rtl8192u: Clean up tests if NULL returned on failure

Author: Bhumika Goyal <bhumirks@gmail.com> Some functions return Null as their return value on failure. !x is generally preferred over x==NULL or NULL==x. So make use of !x if the value returned on failure is NULL. Done using coccinelle: @@ expression e; statement S; @@ e = \(kmalloc\|devm_kzalloc\|kmalloc_array \|devm_ioremap\|usb_alloc_urb\|alloc_netdev\)(…); – if(e==NULL) + if(!e) S Signed-off-by: Bhumika …

Continue reading

6lowpan: fix error checking code

Author: Andrzej Hajda <a.hajda@samsung.com> Bool variable ‘fail’ is always non-negative, it indicates an error if it is true. The problem has been detected using coccinelle script scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci Signed-off-by: Andrzej Hajda Acked-by: Alexander Aring Signed-off-by: Marcel Holtmann — net/6lowpan/iphc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)   diff –git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c index 8dd8388..06287ac …

Continue reading

staging: speakup: remove multiple assignments

Author: Alison Schofield <amsfield22@gmail.com> Remove multiple assignments by factorizing. Coccinelle semantic patch used: @@ identifier x,y; constant z; @@ – x=y=z; + x=z; + y=z; Signed-off-by: Alison Schofield Signed-off-by: Greg Kroah-Hartman — drivers/staging/speakup/main.c | 29 +++++++++++++++++++———- 1 file changed, 19 insertions(+), 10 deletions(-)   diff –git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c index eb8d65a..a87224c 100644 — a/drivers/staging/speakup/main.c +++ b/drivers/staging/speakup/main.c …

Continue reading

staging: lustre: libcfs: Use swap() in cfs_hash_bd_order()

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Use swap() function instead of using a temporary variable for swapping two variables. The Coccinelle semantic patch used to make this change is as follows: // @@ type T; T a,b,c; @@ – a = b; – b = c; – c = a; + swap(b, c); // Signed-off-by: Amitoj …

Continue reading

staging: rtl8192u: ieee802111: Drop Useless Initialization

Author: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Removed initialisation of a varible if it is immediately reassigned. Changes were made using Coccinelle. @bad@ identifier i; position p; @@ i =@p ; @@ type T; constant C; expression e; identifier i; position p != bad.p; @@ T i – = C ; i =@p e; Signed-off-by: Bhaktipriya Shridhar Signed-off-by: …

Continue reading

staging: rtl8188eu: hal: Drop Useless Initialization

Author: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Removed initialisation of a varible if it is immediately reassigned. Changes were made using Coccinelle. @bad@ identifier i; position p; @@ i =@p ; @@ type T; constant C; expression e; identifier i; position p != bad.p; @@ T i – = C ; i =@p e; Signed-off-by: Bhaktipriya Shridhar Signed-off-by: …

Continue reading

staging: netlogic: Simplify use of devm_ioremap_resource

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Remove unneeded error handling on the result of a call to platform_get_resource when the value is passed to devm_ioremap_resource. The Coccinelle semantic patch that makes this change is as follows: // @@ expression pdev,res,n,e,e1; expression ret != 0; identifier l; @@ – res = platform_get_resource(pdev, IORESOURCE_MEM, n); … when != …

Continue reading

staging: dgnc: delete parentheses around right hand side of assignment

Author: Eva Rachel Retuya <eraretuya@gmail.com> Eliminate unneeded parentheses around the right hand side of an assignment. Coccinelle semantic patch used: @@ expression e1, e2; identifier v; @@ ( v = (e1 == e2) | v = (e1 != e2) | v = (e1 = e2) | v = – ( e1 – ) ) Signed-off-by: …

Continue reading

arm-cci: fix handling cpumask_any_but return value

Author: Andrzej Hajda <a.hajda@samsung.com> cpumask_any_but returns value >= nr_cpu_ids if there are no more CPUs. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576 Acked-by: Olof Johansson Signed-off-by: Andrzej Hajda Acked-by: Will Deacon Signed-off-by: Suzuki K Poulose Signed-off-by: Will Deacon — drivers/bus/arm-cci.c | 2 +- 1 file changed, 1 insertion(+), 1 …

Continue reading

BtrLinux
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.