Category: Linux

staging: rtl8712: rtl871x_ioctl_linux: Clean up tests if NULL returned on failure

Author: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Some functions like kmalloc/kzalloc return NULL on failure. When NULL represents failure, !x is commonly used. This was done using Coccinelle: @@ expression *e; identifier l1; @@ e = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\)(…); … – e == NULL + !e Signed-off-by: Bhaktipriya Shridhar Signed-off-by: Greg Kroah-Hartman — drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 4 ++– 1 file changed, …

Continue reading

staging: rtl8712: rtl871x_cmd: Clean up tests if NULL returned on failure

Author: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Some functions like kmalloc/kzalloc return NULL on failure. When NULL represents failure, !x is commonly used. This was done using Coccinelle: @@ expression *e; identifier l1; @@ e = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\)(…); … – e == NULL + !e Signed-off-by: Bhaktipriya Shridhar Signed-off-by: Greg Kroah-Hartman — drivers/staging/rtl8712/rtl871x_cmd.c | 80 +++++++++++++++++—————— 1 file changed, …

Continue reading

staging: rtl8712: rtl871x_mlme: Clean up tests if NULL returned on failure

Author: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Some functions like kmalloc/kzalloc return NULL on failure. When NULL represents failure, !x is commonly used. This was done using Coccinelle: @@ expression *e; identifier l1; @@ e = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\)(…); … – e == NULL + !e Signed-off-by: Bhaktipriya Shridhar Signed-off-by: Greg Kroah-Hartman — drivers/staging/rtl8712/rtl871x_mlme.c | 4 ++– 1 file changed, …

Continue reading

staging: rtl8712: usb_ops_linux: Clean up tests if NULL returned on failure

Author: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Some functions like kmalloc/kzalloc return NULL on failure. When NULL represents failure, !x is commonly used. This was done using Coccinelle: @@ expression *e; identifier l1; @@ e = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\)(…); … – e == NULL + !e Signed-off-by: Bhaktipriya Shridhar Signed-off-by: Greg Kroah-Hartman — drivers/staging/rtl8712/usb_ops_linux.c | 2 +- 1 file changed, …

Continue reading

staging: rtl8712: os_intfs: Change form of NULL comparisons

Author: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Change null comparisons of the form x == NULL to !x. This was done using Coccinelle. @@ expression e; @@ – e == NULL + !e Signed-off-by: Bhaktipriya Shridhar Signed-off-by: Greg Kroah-Hartman — drivers/staging/rtl8712/os_intfs.c | 4 ++– 1 file changed, 2 insertions(+), 2 deletions(-)   diff –git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c index ab19112..57211f7 …

Continue reading

scripts: coccinelle: remove check to move constants to right

Author: Wolfram Sang <wsa@the-dreams.de> The header mentions this check depends on personal taste. I agree. Running coccicheck on patches before I apply them, this SmPL produced enough false positives for me that I’d rather see it removed. Signed-off-by: Wolfram Sang Acked-by: Julia Lawall Signed-off-by: Michal Marek — scripts/coccinelle/misc/compare_const_fl.cocci | 171 ————————- 1 file changed, 171 …

Continue reading

staging: lustre: lnet: Replace sg++ with sg = sg_next(sg)

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> With scatterlist chaining, simply incrementing the array does not work. sg_next macro was thus introduced to follow the chain links when necessary. So replace sg++ with sg_next. This change was made with the help of the following Coccinelle semantic patch: // @@ struct scatterlist *sg; @@ -sg++ +sg = sg_next(sg) …

Continue reading

misc: mic: Remove return statements from void functions

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Return statements at the end of void functions are useless. The Coccinelle semantic patch used to make this change is as follows: // @@ identifier f; expression e; @@ void f(…) { } // Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman — drivers/misc/mic/host/mic_boot.c | 6 +++— 1 file changed, 3 …

Continue reading

crypto: n2 – Remove return statement from void function

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Return statement at the end of a void function is useless. The Coccinelle semantic patch used to make this change is as follows: // @@ identifier f; expression e; @@ void f(…) { } // Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Herbert Xu — drivers/crypto/n2_core.c | 2 +- 1 file changed, …

Continue reading

Staging: rtl8723au: rtl8723a_rf6052: Remove unnecessary semicolon.

Author: Sandhya Bankar <bankarsandhya512@gmail.com> Remove unnecessary semicolon. Coccinelle sementic patch as follows: @r_case@ position p; @@ switch (…) { case …: …;@p } @r_default@ position p; @@ switch (…) { default: …;@p } @r1@ statement S; position p1; position p != {r_case.p, r_default.p}; identifier label; @@ ( label:; | S@p1;@p ) Signed-off-by: Sandhya Bankar Signed-off-by: …

Continue reading