Remove "break" statement after a "return" statement as
it does not get executed.
Found by checkpatch.pl - break is not useful after a goto
or return
Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch removes the _bss_ht struct and the associated type definition
because it is not used and it also introduces the warning:
"WARNING: do not add new typedefs".
Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch detects the cases in which a variable is not modified through
the code and it is used as a return value. The variable is detected and
removed by coccinelle using the following semantic patch:
@@ type T; expression expr; identifier r; constant c; @@
-T r = expr;
... when != r
when strict
-return r;
+return expr;
Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The function setup_timer combines the initialization of a timer with the
initialization of the timer's function and data fields.
So, this patch combines the multiline code for timer initialization using the function
setup_timer. This issue is identified via coccinelle script.
@@
expression E1, E2, E3;
type T;
@@
- init_timer(&E1);
...
(
- E1.function = E2;
...
- E1.data = (T)E3;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.data = (T)E3;
...
- E1.function = E2;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.function = E2;
+ setup_timer(&E1, E2, 0);
)
Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch removes some serious spelling errors and adds small
improvements to the phrases in order to make them easier to understand.
Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch fixes checkpatch.pl issues with "do not use // C99 comments" errors in ieee80211_rx.c
Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The following patch fixes the checkpatch.pl warning:
WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Using functions of the form __constant_<foo> isn't preferred
outside of include/uapi/ as using the function without
__constant_ is identical when the argument is a constant.
So, this patch replaces __constant_htons with htons.
This is done using Coccinelle and semantic patch used for
this is as follows:
@@identifier x;@@
(
- __constant_htons(x)
+ htons(x)
|
- __constant_htonl(x)
+ htonl(x)
|
- __constant_ntohs(x)
+ htons(x)
|
- __constant_ntohl(x)
+ htonl(x)
)
Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This fixes the following checkpatch.pl warning:
WARNING: __constant_cpu_to_le16 should be cpu_to_le16
Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Check if kmalloc succeded before using the pointer in memcpy.
Signed-off-by: Matteo Semenzato <mattew8898@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
else after return generally is not useful. This patch removes else after return
statement. Issue addressed by checkpatch.pl.
Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use timer API function del_timer_sync instead of driver
specific function _cancel_timer as besides deactivating
a timer, it also ensures that the timer is stopped on all
CPUs before the driver exists. Also, variables
timer_cancelled and bool are removed as they are no longer
needed.
@a@
expression x;
identifier y;
@@
- _cancel_timer (&x, &y);
+ del_timer_sync (&x);
@@type T; identifier a.y;@@
- T y;
...when != y
Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use timer API function del_timer_sync instead of driver
specific function _cancel_timer_ex as besides deactivating
a timer, it ensures that the timer is stopped on all
CPUs before the driver exists. Also, definition of function
_cancel_timer_ex is removed as it is no longer needed after
this change.
This is done using Coccinelle and semantic patch used for
this is as follows:
@@ expression x; @@
- _cancel_timer_ex (&x);
+ del_timer_sync (&x);
Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove "break" statement after a "return" statement as
it does not get executed.
Deadcode found by coccinelle --debug option
Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Parentheses are not needed around the right hand side of an assignment.
This patch remove parenthese of such occurences. Issue was detected and
solved using the following coccinelle script:
@rule1@
identifier x, y, z;
expression E1, E2;
@@
(
x = (y == z);
|
x = (E1 == E2);
|
x =
-(
...
-)
;
)
Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The function setup_timer combines the initialization of a timer with the
initialization of the timer's function and data fields.
So, this patch combines the multiline code for timer initialization using the function
setup_timer. This issue is identified via coccinelle script.
@@
expression E1, E2, E3;
type T;
@@
- init_timer(&E1);
...
(
- E1.function = E2;
...
- E1.data = (T)E3;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.data = (T)E3;
...
- E1.function = E2;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.function = E2;
+ setup_timer(&E1, E2, 0);
)
Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
found by checkpatch.pl :ERROR: return is not a function,
parentheses are not required
changes made using coccinelle script:
@@
expression e,e1;
@@
(
return (e / e1);
|
return
-(
e
-)
;
)
Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch adds space after ',' for the better readability of
code. This issue is detected by checkpatch.pl
Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
static ints are initialized to 0 by the compiler.
Explicit initialization is not necessary.
Found by checkpatch.pl - ERROR: do not initialise statics to 0 or NULL
changes made using coccinelle script:
@@
type T;
identifier var;
@@
static T var
- =0
;
Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Found by checkpatch.pl - ERROR: Bad function definition
A function with no arguments allows for variadic arguments. Add
void in between the empty parentheses to indicate that the function
takes no arguments.
changes made using coccinelle script:
@@
type T;
identifier f;
@@
T f(
+void
) {
...
}
Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove switch cases indentation in order to follow the Linux coding style.
Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...)
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...)
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...)
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...)
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...)
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...)
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...)
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...)
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Handles the following issues:
Removing extra parentheses around function arguments,
Removing unnecessary pointer to pointer casts.
Issues were detected using the following coccinelle script:
@@
expression e;
type t;
identifier f;
@@
f(...,
-(t *)
e
,...)
@@
expression e;
identifier f;
@@
f(...,
&
-(
e
-)
,...)
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...)
Parentheses removal were left to the script. However, there were some
cases that were handled manually. In addition, handling pointer casts
were done manually too because not all replacements generated by the
script were suitable. When pointer casts on function arguments were
in the form:
<func>(...,(<type> *)&<expression>,...)
the replacements were discarded due to compilation warnings.
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Handles the following issues:
Removing extra parentheses around function arguments,
Removing unnecessary pointer to pointer cast.
Issues were detected using the following coccinelle script:
@@
expression e;
type t;
identifier f;
@@
f(...,
-(t *)
e
,...)
@@
expression e;
identifier f;
@@
f(...,
&
-(
e
-)
,...)
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...)
Parentheses removal were left to the script. However, handling pointer
casts were done manually because not all replacements generated by the
script were suitable. In general, the following cases were discarded:
pointer casts in macros,
pointer casts on function arguments in the form of:
<func>(...,(<type> *)&<expression>,...)
since both cases generated compilation warnings.
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Handles the following issues:
Removing extra parentheses around function arguments,
Removing unnecessary pointer to pointer cast.
Issues were detected using the following coccinelle script:
@@
expression e;
type t;
identifier f;
@@
f(...,
-(t *)
e
,...)
@@
expression e;
identifier f;
@@
f(...,
&
-(
e
-)
,...)
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...)
Parentheses removal were left to the script. However, handling pointer
casts were done manually because not all replacements generated by the
script were suitable. In general, the following cases were discarded:
pointer casts in macros,
pointer casts on function arguments in the form of:
<func>(...,(<type> *)&<expression>,...)
since both cases generated compilation warnings.
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Handles the following issues:
Removing extra parentheses around function arguments,
Removing unnecessary pointer to potinter cast.
Issues were detected using the following coccinelle
script:
@@
expression e;
type t;
identifier f;
@@
f(...,
-(t *)
e
,...)
@@
expression e;
identifier f;
@@
f(...,
&
-(
e
-)
,...)
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...)
Parentheses removal were left to the script. However, handling pointer
casts were done manually because not all replacements generated by the
script were suitable. In general, the following cases were discarded:
pointer casts in macros,
pointer casts on function arguments in the form of:
<func>(...,(<type> *)&<expression>,...)
since both cases generated compilation warnings.
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Handles the following issues:
Removing extra parentheses around function arguments,
Removing unnecessary pointer to pointer cast.
Issues detected and resolved using the following coccinelle
script:
@@
expression e;
type t;
identifier f;
@@
f(...,
-(t *)
e
,...)
@@
expression e;
identifier f;
@@
f(...,
&
-(
e
-)
,...)
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...)
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Removes unnecessary pointer to pointer cast on function arguments.
It is worth noting that buf is already a u8 pointer.
Issue detected and resolved using the following coccinelle script:
@@
expression e;
type t;
identifier f;
@@
f(...,
-(t *)
e
,...)
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Removes pointer to pointer cast on function arguments. Issue
detected and resolved using the following coccinelle script:
@@
expression e;
type t;
identifier f;
@@
f(...,
-(t *)
e
,...)
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Handles the following issues:
Removing extra parentheses around function arguments,
Removing unnecessary pointer to pointer casts.
Issues detected and resolved using the following coccinelle
script:
@@
expression e;
type t;
identifier f;
@@
f(...,
-(t *)
e
,...)
@@
expression e;
identifier f;
@@
f(...,
&
-(
e
-)
,...)
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...)
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Removes pointer to pointer cast on a function argument. Issue
detected and resolved using the following coccinelle script:
@@
expression e;
type t;
identifier f;
@@
f(...,
-(t *)
e
,...)
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:
@@
expression e;
identifier f;
@@
f(...,
&
-(
e
-)
,...)
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:
@@
expression e;
identifier f;
@@
f(...,
-(
e
-)
,...);
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The function setup_timer combines the initialization of a timer with the
initialization of the timer's function and data fields.
So, this patch combines the multiline code for timer initialization using the function
setup_timer. This issue is identified via coccinelle script.
@@
expression E1, E2, E3;
type T;
@@
- init_timer(&E1);
...
(
- E1.function = E2;
...
- E1.data = (T)E3;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.data = (T)E3;
...
- E1.function = E2;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.function = E2;
+ setup_timer(&E1, E2, 0);
)
Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Code using doubly linked list is iterated generally using list_empty and
list_entry functions, but it can be better written using list_for_each_entry
macro.
This patch replaces the while loop containing list_empty and list_entry with
list_for_each_entry and list_for_each_entry_safe. list_for_each_entry is a
macro which is used to iterate over a list of given type. So while loop used to
iterate over a list can be replaced with list_for_each_entry macro. However, if
list_del is used in the loop, then list_for_each_entry_safe is a better choice.
This transformation is done by using the following coccinelle script.
@ rule1 @
expression E1;
identifier I1, I2;
type T;
iterator name list_for_each_entry;
@@
- while (list_empty(&E1) == 0)
+ list_for_each_entry (I1, &E1, I2)
{
...when != T *I1;
- I1 = list_entry(E1.next, T, I2);
...when != list_del(...);
when != list_del_init(...);
}
@ rule2 @
expression E1;
identifier I1, I2;
type T;
iterator name list_for_each_entry_safe;
@@
T *I1;
+ T *tmp;
...
- while (list_empty(&E1) == 0)
+ list_for_each_entry_safe (I1, tmp, &E1, I2)
{
...when != T *I1;
- I1 = list_entry(E1.next, T, I2);
...
}
Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Parentheses are not needed around the right hand side of an assignment.
This patch remove parenthese of such occurenses. Issue was detected and
solved using the following coccinelle script:
@rule1@
identifier x, y, z;
expression E1, E2;
@@
(
x = (y == z);
|
x = (E1 == E2);
|
x =
-(
...
-)
;
)
Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch replaces the printk() function with netdev_dbg() in order to
fix the following: "WARNING: printk() should include KERN_ facility level"
and "WARNING: line over 80 characters".
Issue found by checkpatch.pl
Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch introduces a new function for the authentication response
error check in the ieee80211_rx_frame_softmac() function to fix the
indentation problem. It also adds the iotAction variable in the new
function to fix the "more than 80 characters per line" warning.
Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch removes unnecessary return statement from a void
function and hence make it more compatible.
This issue is identified by checkpatch.pl
Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch removes a redundant variable "val" and adds
inline return statements. It also adds a default case
to the switch statement which returns 0 to keep the logic
intact.
It also removes a redundant variable "inx" and adds inline
return statements.
This issue is identified by the following coccinelle script.
@@
expression ret;
identifier f;
@@
-ret =
+return
f(...);
-return ret;
Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
warning fixed:
WARNING: line over 80 characters
The function call containing several variables is broken to make it fit
in 80 characters.
Signed-off-by: Himani Agrawal <himani93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>