Catégorie : Linux

Staging: lustre: Return statement is moved left after removing else

Author: Vaishali Thakkar <vthakkar1994@gmail.com> This patch fixes following checkpatch.pl warning using coccinelle: WARNING: else is not generally useful after a break or return Semantic patch used for this is as follows: @rule1@ expression e1; @@ if (e1) { … return …; } – else{ … – } @rule2@ expression e2; statement s1; @@ if(e2) { …

Lire la suite

Staging: lustre: Unnecessory else and braces are removed

Author: Vaishali Thakkar <vthakkar1994@gmail.com> This patch fixes following checkpatch.pl warning using coccinelle: WARNING: else is not generally useful after a break or return Semantic patch used for this is as follows: @rule1@ expression e1; @@ if (e1) { … return …; } – else{ … – } @rule2@ expression e2; statement s1; @@ if(e2) { …

Lire la suite

staging: emxx_udc: Do not assign bool to 0/1

Author: Roberta Dobrescu <roberta.dobrescu@gmail.com> This fixes the following coccinelle warning: WARNING: Assignment of bool to 0/1 Signed-off-by: Roberta Dobrescu Acked-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman — drivers/staging/emxx_udc/emxx_udc.c | 12 ++++++—— 1 file changed, 6 insertions(+), 6 deletions(-)   diff –git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 16265d4..6212efb 100644 — a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -705,7 +705,7 @@ static int …

Lire la suite

staging: emxx_udc: Do not use comparisons on bool tests

Author: Roberta Dobrescu <roberta.dobrescu@gmail.com> This fixes the following coccinelle warning: WARNING: Comparison of bool to 0/1 Signed-off-by: Roberta Dobrescu Acked-by: Daniel Baluta Signed-off-by: Greg Kroah-Hartman — drivers/staging/emxx_udc/emxx_udc.c | 6 ++—- 1 file changed, 2 insertions(+), 4 deletions(-)   diff –git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 341b652..16265d4 100644 — a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -2009,8 +2009,7 @@ static inline …

Lire la suite

Staging: vt6656: Merge two lines of code into one

Author: Rajbinder Brar <brar.rajbinder@gmail.com> This patch merges an assignment with an immediately following return of the assigned variable. The following Coccinelle semantic patch was used to make this transformation: @@ expression ret; identifier f; @@ -ret= +return f(…); -return ret; A variable that became unused due to this transformation was also removed. Signed-off-by: Rajbinder Brar …

Lire la suite

staging: dgnc: Replace non-standard spinlock’s macros

Author: Roberta Dobrescu <roberta.dobrescu@gmail.com> This patch replaces non-standard spinlock’s macros. It is done using coccinelle and the following semantic patch: @@ expression x; @@ – DGNC_SPINLOCK_INIT(x) + spin_lock_init(&x) @@ expression x, y; @@ – DGNC_LOCK(x, y) + spin_lock_irqsave(&x, y) @@ expression x, y; @@ – DGNC_UNLOCK(x, y) + spin_unlock_irqrestore(&x, y) @used_by_lock exists@ typedef ulong; symbol …

Lire la suite

[media] dib0700_devices: Use c99 initializers for structures.

Author: Mauro Carvalho Chehab <mchehab@osg.samsung.com> A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @decl@ identifier i1,fld; type T; field list[n] fs; @@ struct i1 { fs T fld; …}; @bad@ identifier decl.i1,i2; expression e; initializer list[decl.n] is; @@ struct i1 i2 = { is, + .fld = …

Lire la suite

Staging: vme: devices: Merges two lines of code and removes unused variable

Author: Mahati Chamarthy <mahati.chamarthy@gmail.com> This patch merges an assignment with an immediately following return of the assigned variable. The following Coccinelle semantic patch was used to make this transformation: @@ expression ret; identifier f; @@ -ret = +return f(…); -return ret; Signed-off-by: Mahati Chamarthy Signed-off-by: Greg Kroah-Hartman — drivers/staging/vme/devices/vme_user.c | 4 +— 1 file changed, …

Lire la suite

staging: rtl8192u: remove unecessary variable

Author: Tapasweni Pathak <tapaswenipathak@gmail.com> This patch removes unncessary variable in file r8192U_core.c using Coccinelle. Semantic patch for this is as follows : @@ identifier ret; @@ -int ret = 0; … when != ret when strict -return ret; +return 0; Signed-off-by: Tapasweni Pathak Signed-off-by: Greg Kroah-Hartman — drivers/staging/rtl8192u/r8192U_core.c | 9 ++++—– 1 file changed, 4 …

Lire la suite

staging: rtl8712: merge lines and remove unused variable for immediate return

Author: Tapasweni Pathak <tapaswenipathak@gmail.com> This patch merge two lines in a single line if immediate return is found. Unused variables in each case were removed manually as they are no longer needed. This is done using Coccinelle. Semantic patch used for this is as follows : @@ expression ret; identifier f; @@ -ret = +return …

Lire la suite