James Simmons [Sat, 12 Mar 2016 01:29:49 +0000 (20:29 -0500)]
staging: lustre: test for proper errno code in lstcon_rpc_trans_abort
The error value returned will be -ETIMEDOUT not ETIMEDOUT. This fixes
a typo that prevents us from handling the error case.
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
James Simmons [Sat, 12 Mar 2016 01:29:47 +0000 (20:29 -0500)]
staging: lustre: filter remaining extra spacing for lnet selftest
This patch is a result of a filter applied to the lnet selftest
code to remove the last bits of hidden white spaces.
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
James Simmons [Sat, 12 Mar 2016 01:29:46 +0000 (20:29 -0500)]
staging: lustre: remove extra spacing when setting variable for lnet selftest
Remove any extra spacing for the lines of code setting variables to
some value.
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
James Simmons [Sat, 12 Mar 2016 01:29:45 +0000 (20:29 -0500)]
staging: lustre: remove extra spacing of variable declartions for lnet selftest
Remove any extra spacing such as "int rc" to "int rc" to match
the proper kernel style
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
James Simmons [Sat, 12 Mar 2016 01:29:44 +0000 (20:29 -0500)]
staging: lustre: fix spacing issues checkpatch reported in lnet selftest
Remove any extra spacing as reported by checkpatch.
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
James Simmons [Sat, 12 Mar 2016 01:29:43 +0000 (20:29 -0500)]
staging: lustre: remove returns in void function for lnet selftest
No reason to have returns at end of void function.
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Isaac Huang [Sat, 12 Mar 2016 01:29:42 +0000 (20:29 -0500)]
staging: lustre: fix bogus lst errors for lnet selftest
It should not be counted as errors if a test RPC
has been stopped due to administrative actions,
e.g. lst end_session from the remote test console.
Signed-off-by: Isaac Huang <he.huang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4181
Reviewed-on: http://review.whamcloud.com/13279
Reviewed-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
G Pooja Shamili [Fri, 11 Mar 2016 23:52:02 +0000 (05:22 +0530)]
staging: netlogic: Replacing pr_err with dev_err after the call to devm_kzalloc
The function devm_kzalloc has a first argument of type struct device *.
This is the type of argument required by printing functions such as
dev_info, dev_err, etc. Thus, functions like pr_info should not
normally be used after a call to devm_kzalloc. Thus, all pr_err occurances are
replaced with dev_err function calls
Signed-off-by: G Pooja Shamili <poojashamili@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
G Pooja Shamili [Fri, 11 Mar 2016 23:58:54 +0000 (05:28 +0530)]
staging: mt29f_spinand: Replacing pr_info with dev_info after the call to devm_kzalloc
The function devm_kzalloc has a first argument of type struct device *.
This is the type of argument required by printing functions such as
dev_info, dev_err, etc. Thus, functions like pr_info should not normally
be used after a call to devm_kzalloc. Thus, all pr_info occurances are
replaced with dev_info function calls.
This was done using Coccinelle, the patch being:
@@
expression E1,E2;
expression list args;
@@
E1 = devm_kzalloc(E2, ...);
<...
- pr_info(
+ dev_info(E2,
args);
...>
Signed-off-by: G Pooja Shamili <poojashamili@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Kroah-Hartman [Fri, 11 Mar 2016 22:43:06 +0000 (14:43 -0800)]
staging: android: ion: fix up file mode
An older accidentally changed this to executable, so fix it back up.
Gotta love windows editors...
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Derek Yerger [Fri, 11 Mar 2016 22:31:18 +0000 (17:31 -0500)]
staging: ion: debugfs invalid gfp mask
The current code attempts assignment of -1 to an unsigned type. Note that
in a downstream function ion_page_pool_shrink this mask is only ever
evaluated against __GFP_HIGHMEM
(drivers/staging/android/ion/ion_page_pool.c, line 125).
Signed-off-by: Derek Yerger <dy@drexel.edu>
Reviewed-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Fri, 11 Mar 2016 20:36:24 +0000 (02:06 +0530)]
staging: rts5208: Replace pci_enable_device with pcim_enable_device
Devm_ functions allocate memory that is automatically freed when
a driver detaches.
Replace pci_enable_device with pcim_enable_device. Remove unnecessary
pci_disable_device and pci_release_regions from probe and remove
functions in rts5208 driver since pcim_enable_device contains a call
to pcim_release which contains calls to both pci_disable_device and
pci_release_regions.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sandhya Bankar [Sun, 6 Mar 2016 10:49:28 +0000 (16:19 +0530)]
Staging: ieee80211: Place constant on right side of the test.
Place constant on right side of the test.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Sun, 6 Mar 2016 01:15:07 +0000 (06:45 +0530)]
staging: speakup: Replace del_timer with del_timer_sync
Use del_timer_sync to ensure timer is stopped on all CPUs before
the driver exists and the timer should not run when the module is
being removed. Since the timer is not called from an interrupt
context, this change is safe and will not cause deadlock.
The Coccinelle semantic patch used to make this change is as
follows:
// <smpl>
@r@
declarer name module_exit;
identifier ex;
@@
module_exit(ex);
@@
identifier r.ex;
@@
ex(...) {
<...
- del_timer
+ del_timer_sync
(...)
...>
}
// </smpl>
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sandeep Jain [Mon, 29 Feb 2016 13:18:30 +0000 (18:48 +0530)]
staging: lowmemorykiller: fix 2 checks that checkpatch complained
Specifically:
lowmemorykiller.c:53: CHECK: use a blank line after enum declarations
lowmemorykiller.c:60: CHECK: use a blank line after enum declarations
Signed-off-by: Sandeep Jain <sandeepjain.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Janani Ravichandran [Thu, 25 Feb 2016 19:51:06 +0000 (14:51 -0500)]
staging: mt29f_spinand: Drop void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:
@r@
expression x;
void *e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x) [...]
|
((T *)x)->f
|
- (T *)
e
)
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Fri, 4 Mar 2016 17:15:00 +0000 (22:45 +0530)]
staging: rdma: hfi1: file_ops: Replace ALIGN with PAGE_ALIGN
mm.h contains a helper function PAGE_ALIGN which aligns the pointer
to the page boundary instead of using ALIGN(expression, PAGE_SIZE)
This change was made with the help of the following Coccinelle
semantic patch:
//<smpl>
@@
expression e;
symbol PAGE_SIZE;
@@
(
- ALIGN(e, PAGE_SIZE)
+ PAGE_ALIGN(e)
|
- IS_ALIGNED(e, PAGE_SIZE)
+ PAGE_ALIGNED(e)
)
//</smpl>
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Fri, 4 Mar 2016 17:10:17 +0000 (22:40 +0530)]
staging: rdma: hfi1: driver: Replace IS_ALIGNED with PAGE_ALIGNED
mm.h contains a helper function PAGE_ALIGNED which tests whether
an address is aligned to PAGE_SIZE instead of using
IS_ALIGNED(expression, PAGE_SIZE)
This change was made with the help of the following Coccinelle
semantic patch:
//<smpl>
@@
expression e;
symbol PAGE_SIZE;
@@
(
- ALIGN(e, PAGE_SIZE)
+ PAGE_ALIGN(e)
|
- IS_ALIGNED(e, PAGE_SIZE)
+ PAGE_ALIGNED(e)
)
//</smpl>
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Fri, 4 Mar 2016 17:00:43 +0000 (22:30 +0530)]
staging: rdma: hfi1: Replace ALIGN with PAGE_ALIGN
mm.h contains a helper function PAGE_ALIGN which aligns the pointer
to the page boundary instead of using ALIGN(expression, PAGE_SIZE)
This change was made with the help of the following Coccinelle
semantic patch:
//<smpl>
@@
expression e;
symbol PAGE_SIZE;
@@
(
- ALIGN(e, PAGE_SIZE)
+ PAGE_ALIGN(e)
|
- IS_ALIGNED(e, PAGE_SIZE)
+ PAGE_ALIGNED(e)
)
//</smpl>
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhumika Goyal [Fri, 26 Feb 2016 10:04:31 +0000 (15:34 +0530)]
Staging: rdma: Use min macro instead of ternary operator
This patch replaces ternary operator with macro min as it shorter and
thus increases code readability. Macro min return the minimum of the
two compared values.
Made a semantic patch for changes:
@@
type T;
T x;
T y;
@@
(
- x < y ? x : y
+ min(x,y)
|
- x > y ? x : y
+ max(x,y)
)
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Janani Ravichandran [Thu, 25 Feb 2016 20:08:17 +0000 (15:08 -0500)]
staging: rdma: hfi1: user_sdma.c: Drop void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:
@r@
expression x;
void *e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x) [...]
|
((T *)x)->f
|
- (T *)
e
)
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Thu, 25 Feb 2016 13:24:44 +0000 (18:54 +0530)]
staging: rdma: hfi1: Remove unnecessary parantheses
Removed parantheses on the right hand side of assignments as they are not
needed. Coccinelle patch used:
@@ expression a, b; @@
a = &
-(
b
-)
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Thu, 25 Feb 2016 13:24:03 +0000 (18:54 +0530)]
staging: rdma: hfi1: Remove casts of pointer to same type
Casting a pointer to a pointer of the same type is unnecessary, so
remove these unnecessary casts.
This was done with Coccinelle:
@@
type T;
T *ptr;
@@
- (T *)ptr
+ ptr
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Thu, 25 Feb 2016 11:52:11 +0000 (17:22 +0530)]
staging: rdma: hfi1: Remove useless return variables
This patch removes unnecessary return variables and compresses the
return logic.
The coccinelle script that finds and fixes this issue is:
@@ type T; identifier i,f; constant C; @@
- T i;
...when != i
when strict
( return -C;
|
- i =
+ return
f(...);
- return i;
)
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Thu, 25 Feb 2016 05:38:09 +0000 (11:08 +0530)]
staging: rdma: hfi1: Remove unnecessary pci_set_drvdata()
Unnecessary pci_set_drvdata() has been removed since the driver
core clears the driver data to NULL after device release or on
probe failure. There is no need to manually clear the device
driver data to NULL.
The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
struct pci_dev *pci;
@@
- pci_set_drvdata(pci, NULL);
//</smpl>
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Janani Ravichandran [Wed, 24 Feb 2016 01:06:12 +0000 (20:06 -0500)]
staging: rdma: hfi1: Do not use | with a variable with value 0
mr->lkey has a value equal to 0. There is no need to combine it with
other things with | as for any value x, 0|x is always x.
Semantic patch used:
@@
expression x, e, e1;
statement S;
@@
if (x == 0) {
... when != x = e1
when != while(...) S
when != for(...;...;...) S
(
* x |= e
|
* x | e
)
... when any
}
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Mon, 22 Feb 2016 17:03:34 +0000 (22:33 +0530)]
staging: rdma: hfi1: Compress return logic
Simplified function return by merging assignment and return into
one line.
Found with Coccinelle.
@@
expression e;
local idexpression ret;
@@
- ret =
+ return
e;
- return ret;
@@ type T; identifier x; @@
- T x;
... when != x
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Mon, 22 Feb 2016 16:43:39 +0000 (22:13 +0530)]
staging: rdma: hfi1: Remove unnecessary kfree
Remove an unnecessary kfree since rcd->opstats's value must be NULL
for the code to execute `bail` label.
This fixes the following smatch warning:
drivers/staging/rdma/hfi1/init.c:335 hfi1_create_ctxtdata() warn:
calling kfree() when 'rcd->opstats' is always NULL.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Mon, 22 Feb 2016 07:59:20 +0000 (13:29 +0530)]
staging: rdma: hfi1: Use setup_timer
The function setup_timer combines the initialization of a timer with the
initialization of the timer's function and data fields.
The multiline code for timer initialization is now replaced with function
setup_timer.
This was done with Coccinelle.
@@ 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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:11:38 +0000 (01:41 +0530)]
staging: lustre: lnet: o2iblnd: Use list_for_each_entry_safe
Doubly linked lists which are iterated using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.
This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.
This was done with Coccinelle.
@@
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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:10:42 +0000 (01:40 +0530)]
staging: lustre: lnet: socklnd: Use list_for_each_entry_safe
Doubly linked lists which are iterated using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.
This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.
This was done with Coccinelle.
@@
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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:09:28 +0000 (01:39 +0530)]
staging: lustre: lnet: socklnd_proto: Use list_for_each_entry_safe
Doubly linked lists which are iterated using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.
This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.
This was done with Coccinelle.
@@
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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:08:37 +0000 (01:38 +0530)]
staging: lustre: libcfs: Use list_for_each_entry_safe
Doubly linked lists which are iterated using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.
This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.
This was done with Coccinelle.
@@
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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:07:35 +0000 (01:37 +0530)]
staging: lustre: osc_cache: Use list_for_each_entry_safe
Doubly linked lists which are iterated using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.
This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.
This was done with Coccinelle.
@@
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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:06:51 +0000 (01:36 +0530)]
staging: lustre: osc: Use list_for_each_entry_safe
Doubly linked lists which are iterated using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.
This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.
This was done with Coccinelle.
@@
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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:05:29 +0000 (01:35 +0530)]
staging: lustre: lnet: api-ni: Use list_for_each_entry_safe
Doubly linked lists which are iterated using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.
This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.
This was done with Coccinelle.
@@
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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:03:46 +0000 (01:33 +0530)]
staging: lustre: lnet: peer: Use list_for_each_entry_safe
Doubly linked lists which are iterated using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.
This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.
This was done with Coccinelle.
@@
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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:03:03 +0000 (01:33 +0530)]
staging: lustre: lnet: config: Use list_for_each_entry_safe
Doubly linked lists which are iterated using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.
This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.
This was done with Coccinelle.
@@
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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:02:13 +0000 (01:32 +0530)]
staging: lustre: lnet: router: Use list_for_each_entry_safe
Doubly linked lists which are iterated using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.
This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.
This was done with Coccinelle.
@@
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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:01:20 +0000 (01:31 +0530)]
staging: lustre: lnet: conrpc: Use list_for_each_entry_safe
Doubly linked lists which are iterated using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.
This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.
This was done with Coccinelle.
@@
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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:00:15 +0000 (01:30 +0530)]
staging: lustre: lnet: lib-move: Use list_for_each_entry_safe
Doubly linked lists which are iterated using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.
This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.
This was done with Coccinelle.
@@
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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Fri, 11 Mar 2016 19:59:21 +0000 (01:29 +0530)]
staging: lustre: obdclass: Use list_for_each_entry_safe
Doubly linked lists which are iterated using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.
This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.
This was done with Coccinelle.
@@
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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Thu, 10 Mar 2016 17:11:53 +0000 (22:41 +0530)]
staging: iio: addac: Remove unnecessary else after return
This patch fixes the checkpatch warning that else is not generally
useful after a break or return.
This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
s1
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Georgiana Chelu [Mon, 7 Mar 2016 08:31:54 +0000 (10:31 +0200)]
Staging: iio: Fixed block comments warning
Fixed the following warning:
WARNING: Block comments use a trailing */ on a separate line
Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sandhya Bankar [Sun, 6 Mar 2016 13:21:55 +0000 (18:51 +0530)]
Staging: iio:
ade7854: Remove unnecessary goto.
Remove unnecessary goto.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sandhya Bankar [Sun, 6 Mar 2016 13:18:47 +0000 (18:48 +0530)]
Staging: iio: ade7758_core: Remove unnecessary goto.
Remove unnecessary goto.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sandhya Bankar [Sun, 6 Mar 2016 13:14:59 +0000 (18:44 +0530)]
Staging: iio:
ade7754: Remove unnecessary goto.
Remove unnecessary goto.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Mon, 29 Feb 2016 07:33:46 +0000 (13:03 +0530)]
staging: iio: adc: Replace of_iomap() with devm_ioremap_resource()
The adc driver uses of_iomap() which doesn't request the resource and
isn't device managed so error handling is needed. of_iomap() is mainly
used in cases where there is no driver or struct device so a switch to
devm_ functions is required.
This patch switches to use devm_ioremap_resource() instead which
automatically requests the resource and is freed when the driver
detaches.
Removed the error handling to unmap I/O registers i.e.
iounmap() in probe and remove functions of this driver and
consequently removed an unnecessary label.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alison Schofield [Sun, 28 Feb 2016 08:22:50 +0000 (00:22 -0800)]
staging: iio:
ade7854: use devm_iio_device_register
Replace iio_device_register with the device managed version.
This change is safe because it does not change the order of
any device removal actions. Unregistering the device was the
only removal action. The newly emptied .remove functions are
deleted.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alison Schofield [Wed, 24 Feb 2016 06:18:50 +0000 (22:18 -0800)]
staging: iio: adt7316: remove useless initialization
Remove the initialization of a variable that is immediately
reassigned.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alison Schofield [Wed, 24 Feb 2016 06:18:01 +0000 (22:18 -0800)]
staging: iio: light: tsl2x7x: remove useless initialization
Remove the initialization of a variable that is immediately
reassigned.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhumika Goyal [Fri, 11 Mar 2016 06:58:50 +0000 (12:28 +0530)]
Staging: rtl8723au: Remove unused functions and prototype
The functions rtw_ap_inform_ch_switch23a, rtw_acl_remove_sta23a and
rtw_acl_add_sta23a are not used anywhere in the kernel. So remove their
definition and prototype.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhumika Goyal [Fri, 11 Mar 2016 06:58:51 +0000 (12:28 +0530)]
taging: rtl8723au: Remove empty function odm_Init_RSSIForDM23a
The function odm_Init_RSSIForDM23a is empty and therefore there is no use
of keeping it. Also, remove its prototype.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Thu, 10 Mar 2016 18:01:22 +0000 (23:31 +0530)]
staging: rtl8723au: hal: Remove unnecessary function and its call
The function odm_DynamicBBPowerSaving23a on being called, simply returns
back. The function hasn't been mentioned in the TODO and doesn't have FIXME
code around. Hence, odm_DynamicBBPowerSaving23a and its calls have been
removed.
This was done using Coccinelle.
@@
identifier f;
@@
void f(...) {
-return;
}
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Thu, 10 Mar 2016 17:00:07 +0000 (22:30 +0530)]
staging: rtl8723au: core: Remove unnecessary else after return
This patch fixes the checkpatch warning that else is not generally
useful after a break or return.
This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
s1
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Tue, 8 Mar 2016 17:58:13 +0000 (23:28 +0530)]
staging: rtl8723au: hal: Use macro DIV_ROUND_UP
The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Sat, 5 Mar 2016 21:19:46 +0000 (02:49 +0530)]
staging: rtl8723au: core: rtw_security: Change form of NULL comparisons
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 <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Sat, 5 Mar 2016 21:17:23 +0000 (02:47 +0530)]
staging: rtl8723au: core: rtw_sta_mgt: Change form of NULL comparisons
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 <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cihangir Akturk [Fri, 4 Mar 2016 13:43:10 +0000 (15:43 +0200)]
drivers: staging: rtl8723au: remove unneeded null test
null test on pnetwork removed, because the iterator variable
list_for_each_entry_safe cannot be null.
This commit fixes the following error reported by coccinelle:
drivers/staging/rtl8723au/core/rtw_mlme.c:1621:7-15: ERROR: iterator
variable bound on line 1620 cannot be NULL
Signed-off-by: Cihangir Akturk <cakturk@gmail.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Tue, 1 Mar 2016 17:33:30 +0000 (23:03 +0530)]
staging: rtl8723au: hal: Remove Unused macro
PlatformIndicateBTACLData is an unused macro. Hence, removed.
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geliang Tang [Tue, 1 Mar 2016 15:22:23 +0000 (23:22 +0800)]
staging: rtl8723au: fix static checker warning
Fix the following static checker warning:
drivers/staging/rtl8723au/core/rtw_sta_mgt.c:365 rtw_get_stainfo23a()
error: potential NULL dereference 'psta'.
Fixes: e280d71("staging: rtl8723au: use list_for_each_entry*()")
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhumika Goyal [Sun, 28 Feb 2016 17:25:29 +0000 (22:55 +0530)]
Staging: rtl8723au: Remove print statements and debug messages
The memory allocation functions generates a call stack containing
all the context information on failure, so print statements and debug
messages can be removed on failure of these functions. Also remove
unwanted {} around if block after removal of these messages.
Done using coccinelle:
@@
expression e;
@@
e=\(kmalloc\|kmalloc\|kmalloc_array\|alloc_netdev\|kzalloc\|
devm_kzalloc\|devm_ioremap\)(...);
...
if(!e){
- \(DBG_8723A\|printk\|pr_err\|CERROR\|DBG_88E\)(...);
...when any
}
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Janani Ravichandran [Sun, 28 Feb 2016 18:39:13 +0000 (13:39 -0500)]
staging: rtl8723au: Eliminate commented out code
Reduce code clutter by removing commented out code.
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhumika Goyal [Fri, 26 Feb 2016 10:04:30 +0000 (15:34 +0530)]
Staging: rtl8723au: Use min macro instead of ternary operator
This patch replaces ternary operator with macro min as it shorter and
thus increases code readability. Macro min return the minimum of the
two compared values.
Made a semantic patch for changes:
@@
type T;
T x;
T y;
@@
(
- x < y ? x : y
+ min(x,y)
|
- x > y ? x : y
+ max(x,y)
)
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Janani Ravichandran [Thu, 25 Feb 2016 19:02:56 +0000 (14:02 -0500)]
staging: rtl8723au: core: Remove CamelCase
Remove CamelCase on the variable FunctionContext.
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Janani Ravichandran [Thu, 25 Feb 2016 19:01:40 +0000 (14:01 -0500)]
staging: rtl8723au: core: Drop unneeded pointer cast
Void pointers don't need to be cast to other pointer types.
Semantic patch used:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x) [...]
|
((T *)x)->f
|
- (T *)
e
)
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhumika Goyal [Fri, 4 Mar 2016 13:45:55 +0000 (19:15 +0530)]
Staging: fsl-mc: Replace pr_err with dev_err
This patch replaces pr_err calls with dev_err when the device structure
is available as dev_* prints identifying information about the struct device.
Done using coccinelle:
@r exists@
identifier f, s;
identifier x;
position p;
@@
f(...,struct s *x,...) {
<+...
when != x == NULL
\(pr_err@p\|pr_debug@p\|pr_info\)(...);
...+>
}
@r2@
identifier fld2;
identifier r.s;
@@
struct s {
...
struct device *fld2;
...
};
@@
identifier r.x,r2.fld2;
position r.p;
@@
(
-pr_err@p
+dev_err
(
+ &x->fld2,
...)
|
- pr_debug@p
+ dev_dbg
(
+ &x->fld2,
...)
|
- pr_info@p
+ dev_info
(
+ &x->fld2,
...)
)
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhumika Goyal [Fri, 4 Mar 2016 13:44:52 +0000 (19:14 +0530)]
Staging: fsl-mc: Replace pr_debug with dev_dbg
This patch replaces pr_debug calls with dev_dbg when the device structure
is available as dev_* prints identifying information about the struct
device.
Done using coccinelle:
@r exists@
identifier f, s;
identifier x;
position p;
@@
f(...,struct s *x,...) {
<+...
when != x == NULL
\(pr_err@p\|pr_debug@p\|pr_info\)(...);
...+>
}
@r2@
identifier fld2;
identifier r.s;
@@
struct s {
...
struct device *fld2;
...
};
@@
identifier r.x,r2.fld2;
position r.p;
@@
(
-pr_err@p
+dev_err
(
+ &x->fld2,
...)
|
- pr_debug@p
+ dev_dbg
(
+ &x->fld2,
...)
|
- pr_info@p
+ dev_info
(
+ &x->fld2,
...)
)
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Sun, 28 Feb 2016 18:28:05 +0000 (23:58 +0530)]
staging: fsl-mc: bus: Eliminate double function call
A call to irq_find_matching_host was already made and the result
has been stored in mc_msi_domain. mc_msi_domain is again reassigned
using the same function call which is redundant.
irq_find_matching_host returns/locates a domain for a given fwnode.
The domain is identified using device node and bus_token(if several
domains have same device node but different purposes they can be
distinguished using bus-specific token).
http://www.bricktou.com/include/linux/irqdomain_irq_find_matching_host_en.html
Also, of_property_read_bool finds and reads a boolean from a property
device node from which the property value is to be read. It doesn't
alter the device node.
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-February/083698.html
Since, both the function calls have the same device node and bus_token,
the return values shall be the same. Hence, the second call has been
removed.
This was done using Coccinelle:
@r@
idexpression *x;
identifier f;
position p1,p2;
@@
x@p1 = f(...)
... when != x
(
x@p2 = f(...)
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].line == p2[0].line):
cocci.include_match(False)
@@
idexpression *x;
identifier f;
position r.p1,r.p2;
@@
*x@p1 = f(...)
...
*x@p2 = f(...)
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Janani Ravichandran [Thu, 25 Feb 2016 19:46:11 +0000 (14:46 -0500)]
staging: fsl-mc: Drop unneeded void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:
@r@
expression x;
void *e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x) [...]
|
((T *)x)->f
|
- (T *)
e
)
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhumika Goyal [Fri, 11 Mar 2016 14:03:05 +0000 (19:33 +0530)]
Staging: android: ashmem.c: Convert macros page_range_{subsumes/subsumed_by/in}_range to static inline function
Convert macros page_range_{subsumes/subsumed_by/in}_range to static
inline function as static inline functions are preferred over macros.
The change can be done as the arguments at all call sites have the same
type. Also, all three macro have same type of arguments and return
values so they can converted using a common semantic patch.
@r@
identifier f;
expression e;
@@
#define f(...) e
@r2@
identifier r.f;
identifier range,start,end;
expression r.e;
@@
- #define f(range,start,end) e
+ static inline int f(struct ashmem_range *range, size_t start, size_t end)
+{
+ return e;
+}
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhumika Goyal [Fri, 11 Mar 2016 14:03:04 +0000 (19:33 +0530)]
Staging: android: ashmem.c: Redefine macros as static inline functions
Convert macros page_in_range and range_before_page into static inline
functions as static inline functions are preferred over macros. The
change can be done as the arguments at all call sites have the same type.
Also, both the macros have same type of arguments and return
values.
Done using coccinelle:
@r@
identifier f;
expression e;
@@
#define f(...) e
@r1@
identifier r.f;
identifier range,page;
expression r.e;
@@
- #define f(range,page) e
+ static inline int f(struct ashmem_range *range, size_t page)
+ {
+ return e;
+ }
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Thu, 25 Feb 2016 14:51:20 +0000 (20:21 +0530)]
staging: android: Use devm_kcalloc instead of devm_kzalloc
Replace devm_kzalloc with devm_kcalloc to ensure there are no integer
overflows from the multiplication of a number * sizeof.
The following Coccinelle semantic patch was used to make this change:
//<smpl>
@@
expression dev,E1,E2,E3;
@@
- devm_kzalloc(dev,E1*sizeof(E2),E3)
+ devm_kcalloc(dev,E1,sizeof(E2),E3)
//</smpl>
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Thu, 25 Feb 2016 02:48:52 +0000 (08:18 +0530)]
staging: android: Replace min_t/max_t with min/max
Replace min_t/max_t with min/max when both variables are of the same
type.
The Coccinelle semantic patch used to make this change is as follows:
@@
type T;
T a,b;
@@
- min_t(T, a, b)
+ min(a, b)
@@
type T;
T a,b;
@@
- max_t(T, a, b)
+ max(a, b)
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Thu, 25 Feb 2016 14:22:27 +0000 (19:52 +0530)]
staging: android: ion: tegra: Replace IS_ERR_OR_NULL with IS_ERR
Replace IS_ERR_OR_NULL test with an IS_ERR test since
ion_device_create() function returns a valid device or a -PTR_ERR
only as evidenced by the comment on the function prototype.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Thu, 25 Feb 2016 13:55:04 +0000 (19:25 +0530)]
staging: android: ion: tegra: Use devm_kcalloc instead of devm_kzalloc
Replace devm_kzalloc with devm_kcalloc to ensure there are no integer
overflows from the multiplication of a number * sizeof.
The following Coccinelle semantic patch was used to make this change:
//<smpl>
@@
expression dev,E1,E3;
type T;
@@
- devm_kzalloc(dev,E1*sizeof(T),E3)
+ devm_kcalloc(dev,E1,sizeof(T),E3)
//</smpl>
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Thu, 25 Feb 2016 11:54:17 +0000 (17:24 +0530)]
staging: android: ion: hisilicon: Remove useless return variables
This patch removes unnecessary return variables and compresses the
return logic.
The coccinelle script that finds and fixes this issue is:
@@ type T; identifier i,f; constant C; @@
- T i;
...when != i
when strict
( return -C;
|
- i =
+ return
f(...);
- return i;
)
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ben Marsh [Wed, 24 Feb 2016 12:42:18 +0000 (13:42 +0100)]
Staging: android: change memory allocation style in ion_carveout_heap.c
This is a patch for ion_carveout_heap.c that changes the memory
allocation style in order to remove a checkpatch.pl warning.
Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ben Marsh [Wed, 24 Feb 2016 12:35:50 +0000 (13:35 +0100)]
Staging: Android: align code with open parenthesis in ion_carveout_heap.c
This is a patch to ion_carveout_heap.c that alligns code with open
parenthesis to remove a checkpatch.pl warning.
Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ben Marsh [Wed, 24 Feb 2016 12:26:16 +0000 (13:26 +0100)]
Staging: Android: change memory allocation style in ion_carveout_heap.c
This is a patch to ion_carveout_heap.c to change the memory allocation
style in order to remove a checkpatch.pl warning.
Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
EunTaik Lee [Wed, 24 Feb 2016 04:38:06 +0000 (04:38 +0000)]
staging/android/ion : fix a race condition in the ion driver
There is a use-after-free problem in the ion driver.
This is caused by a race condition in the ion_ioctl()
function.
A handle has ref count of 1 and two tasks on different
cpus calls ION_IOC_FREE simultaneously.
cpu 0 cpu 1
-------------------------------------------------------
ion_handle_get_by_id()
(ref == 2)
ion_handle_get_by_id()
(ref == 3)
ion_free()
(ref == 2)
ion_handle_put()
(ref == 1)
ion_free()
(ref == 0 so ion_handle_destroy() is
called
and the handle is freed.)
ion_handle_put() is called and it
decreases the slub's next free pointer
The problem is detected as an unaligned access in the
spin lock functions since it uses load exclusive
instruction. In some cases it corrupts the slub's
free pointer which causes a mis-aligned access to the
next free pointer.(kmalloc returns a pointer like
ffffc0745b4580aa). And it causes lots of other
hard-to-debug problems.
This symptom is caused since the first member in the
ion_handle structure is the reference count and the
ion driver decrements the reference after it has been
freed.
To fix this problem client->lock mutex is extended
to protect all the codes that uses the handle.
Signed-off-by: Eun Taik Lee <eun.taik.lee@samsung.com>
Reviewed-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sandhya Bankar [Sun, 6 Mar 2016 10:36:18 +0000 (16:06 +0530)]
Staging: emxx_udc: Return NULL instead of 0.
Return NULL instead of 0 from nbu2ss_ep_alloc_request(),if req pointer is NULL.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Mon, 7 Mar 2016 15:39:30 +0000 (21:09 +0530)]
staging: netlogic: Replace pr_* with netdev_*
Replace generic pr_info and pr_err with netdev_info and netdev_err
respectively for net devices.
Found using Coccinelle. The semantic patch used to find this is as
follows:
//<smpl>
@@
expression e;
identifier f,i;
position p;
@@
f(...,struct net_device *i,...) {
...
(
- pr_debug@p (e)
+ netdev_dbg(i, e)
|
- pr_err@p (e)
+ netdev_err(i, e)
|
- pr_info@p (e)
+ netdev_info(i, e)
)
...
}
@@
expression e;
identifier f,i;
position p;
@@
f(...) {
...
struct net_device *n;
...
(
- pr_debug@p (e)
+ netdev_dbg(n, e)
|
- pr_err@p (e)
+ netdev_err(n, e)
|
- pr_info@p (e)
+ netdev_info(n, e)
)
...
}
@a@
identifier s,x;
@@
struct s {
...
struct net_device *x;
...
};
@b depends on a@
expression e;
identifier f,i,a.s,a.x;
position p;
@@
f ( ..., struct s *i, ...) {
...
(
- pr_debug@p (e)
+ netdev_dbg(i->x, e)
|
- pr_err@p (e)
+ netdev_err(i->x, e)
|
- pr_info@p (e)
+ netdev_info(i->x, e)
)
...
}
@c depends on a@
expression e;
identifier f,i,a.s,a.x;
position p;
@@
f (...) {
...
struct s *i = ...;
...
(
- pr_debug@p (e)
+ netdev_dbg(i->x, e)
|
- pr_err@p (e)
+ netdev_err(i->x, e)
|
- pr_info@p (e)
+ netdev_info(i->x, e)
)
...
}
//</smpl>
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Janani Ravichandran [Thu, 25 Feb 2016 19:09:22 +0000 (14:09 -0500)]
staging: netlogic: Drop unneeded void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x) [...]
|
((T *)x)->f
|
- (T *)
e
)
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Tue, 23 Feb 2016 16:42:16 +0000 (22:12 +0530)]
staging: netlogic: Simplify use of devm_ioremap_resource
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:
// <smpl>
@@
expression pdev,res,n,e,e1;
expression ret != 0;
identifier l;
@@
- res = platform_get_resource(pdev, IORESOURCE_MEM, n);
... when != res
- if (res == NULL) { ... \(goto l;\|return ret;\) }
... when != res
+ res = platform_get_resource(pdev, IORESOURCE_MEM, n);
e = devm_ioremap_resource(e1, res);
// </smpl>
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Shraddha Barke [Sat, 5 Mar 2016 19:25:31 +0000 (00:55 +0530)]
Staging: gdm72xx: Remove gdm72xx driver
Remove support for gdm72xx driver from the kernel since Wimax is dead.
[1] http://www.networkworld.com/article/
2220370/4g/wimax-is-dead.html
[2] http://www.androidcentral.com/sprint-confirms-wimax-shutdown-november-6-2015
Chrome OS can distribute this driver alongside their library.
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Joe Perches [Thu, 10 Mar 2016 11:43:22 +0000 (03:43 -0800)]
staging: skein: threefish_block: Use rol64
Use the inline instead of direct code to improve readability
and shorten the code a little.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ben Marsh [Fri, 11 Mar 2016 19:40:40 +0000 (20:40 +0100)]
Staging: xgifb: remove useless blank lines
This is a patch to XGI_main_26.c that removes useless blanklines as
flagged by checkpatch.pl
Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rehas Sachdeva [Fri, 26 Feb 2016 12:17:51 +0000 (17:47 +0530)]
staging: xgifb: Avoid multiple blank lines
This patch removes the checkpatch.pl warnings regarding multiple blank
lines as single blank line is the preferred coding style.
Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sandhya Bankar [Mon, 7 Mar 2016 12:22:37 +0000 (17:52 +0530)]
Staging: wlan-ng: Do not print message if kzalloc() failed.
Do not print message if kzalloc() failed.
kzalloc() has its own messages. So no need to add extra one.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sandhya Bankar [Mon, 7 Mar 2016 10:45:59 +0000 (16:15 +0530)]
Staging: wlan-ng: Handle error condition.
Handle error condition.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Eva Rachel Retuya [Sat, 27 Feb 2016 12:39:25 +0000 (20:39 +0800)]
staging: wlan-ng: simplify NULL tests
Replace direct comparisons to NULL i.e. 'x == NULL' with '!x' for
consistency. Coccinelle semantic patch used:
@@
identifier func;
expression x;
statement Z;
@@
x = func(...);
if (
(
+ !
x
- == NULL
|
+ !
- NULL ==
x
)
) Z
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Janani Ravichandran [Thu, 25 Feb 2016 19:33:59 +0000 (14:33 -0500)]
staging: wlan-ng: prism2sta.c: Drop unneeded void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:
@r@
expression x;
void *e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x) [...]
|
((T *)x)->f
|
- (T *)
e
)
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Janani Ravichandran [Thu, 25 Feb 2016 19:22:27 +0000 (14:22 -0500)]
staging: wlan-ng: prism2mgmt.c: Drop void pointer cast
Void pointers don't need to be cast to other pointer types.
Semantic patch used:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x) [...]
|
((T *)x)->f
|
- (T *)
e
)
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Janani Ravichandran [Thu, 25 Feb 2016 19:17:50 +0000 (14:17 -0500)]
staging: wlan-ng: prism2mib.c: Drop void pointer cast
Void pointers don't need to be cast to other pointer types.
Semantic patch used:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x) [...]
|
((T *)x)->f
|
- (T *)
e
)
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Janani Ravichandran [Thu, 25 Feb 2016 19:13:24 +0000 (14:13 -0500)]
staging: wlan-ng: Drop void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x) [...]
|
((T *)x)->f
|
- (T *)
e
)
Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Wed, 24 Feb 2016 16:25:49 +0000 (21:55 +0530)]
staging: wlan-ng: Remove unnecessary macro
Remove unnecessary macro SUBMIT_URB by replacing it with a direct call
to usb_submit_urb()
This change was made with the help of the following Coccinelle semantic
patch:
//<smpl>
@@
identifier f,g;
@@
* #define f(...) g(...)
// </smpl>
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Eva Rachel Retuya [Wed, 2 Mar 2016 14:23:46 +0000 (22:23 +0800)]
staging: gs_fpgaboot: drop wrapper function 'finish_driver'
Remove the function 'finish_driver' since a direct call to
platform_device_unregister() is intuitive enough to signify the original
intention of the function being removed. Coccinelle semantic patch used to
detect this:
@@
identifier wrapper, func;
type T;
@@
*T wrapper(...)
{
(
return func(...);
|
func(...);
)
}
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee [Sat, 27 Feb 2016 12:03:35 +0000 (17:33 +0530)]
staging: dgnc: cleanup properly
dgnc_cleanup_module() was called when the module unloaded to do a total
cleanup and it was also called if pci_register_driver() fails. But
dgnc_cleanup_module() will try dgnc_remove_driver_sysfiles() but the
sysfiles will be created only if pci_register_driver() succeeds.
So if pci_register_driver() fails and we try dgnc_cleanup_module() then we
were getting:
[ 942.001479] BUG: unable to handle kernel NULL pointer dereference at
00000018
[ 942.001482] IP: [<
c122c7a8>] sysfs_remove_file_ns+0x8/0x20
with part of the call trace as:
[ 942.001544] Call Trace:
[ 942.001555] [<
c149acc6>] driver_remove_file+0x16/0x20
[ 942.001571] [<
f864a708>] dgnc_remove_driver_sysfiles+0x18/0x40 [dgnc]
[ 942.001575] [<
f8643ac7>] dgnc_cleanup_module+0x47/0x260 [dgnc]
[ 942.001577] [<
f86cb000>] ? 0xf86cb000
[ 942.001580] [<
f86cb1e6>] dgnc_init_module+0x1e6/0x1000 [dgnc]
Lets have a separate cleanup function which will execute
dgnc_remove_driver_sysfiles() depending on the argument passed to it.
Reported-by: Navy Cheng <navych@126.com>
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee [Sat, 27 Feb 2016 12:03:34 +0000 (17:33 +0530)]
staging: dgnc: unregister pci driver
We may choose to load the module without the hardware present. That will
register the pci driver but since probe will not succeed so
dgnc_NumBoards will be 0. Now if we unload the module then the pci
driver stays registered as dgnc_NumBoards is 0. And if we try to load
the module again it fails with the error:
"Driver 'dgnc' is already registered."
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This page took 0.05289 seconds and 5 git commands to generate.