]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/log
mirror_ubuntu-bionic-kernel.git
9 years agodrivers: staging: lustre: lustre: Replace OBD_CPT_ALLOC etc by kzalloc_node
Julia Lawall [Sun, 3 May 2015 13:21:43 +0000 (15:21 +0200)]
drivers: staging: lustre: lustre: Replace OBD_CPT_ALLOC etc by kzalloc_node

Replace OBD_CPT_ALLOC, OBD_CPT_ALLOC_PTR, and OBD_CPT_ALLOC_GFP by
corresponding calls to kzalloc_node.  The semantic patch for the
OBD_CPT_ALLOC case is as follows: (http://coccinelle.lip6.fr/).

// <smpl>
@@ expression ptr,cptab,cpt,size; @@
- OBD_CPT_ALLOC(ptr, cptab, cpt, size)
+ ptr = kzalloc_node(size, GFP_NOFS, cfs_cpt_spread_node(cptab, cpt))
// </smpl>

Note that the original OBD macros would check if the cptab argument was
NULL and fall back on kzalloc in that case.  Oleg Drokin argues that this
test is not needed because the code containing these calls is only invoked
after initialization has been completed, in which case the possible cptab
arguments are not NULL.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: ptlrpc: Replace OBD_CPT_ALLOC etc by kzalloc_node
Julia Lawall [Sun, 3 May 2015 13:21:42 +0000 (15:21 +0200)]
staging: lustre: ptlrpc: Replace OBD_CPT_ALLOC etc by kzalloc_node

Replace OBD_CPT_ALLOC, OBD_CPT_ALLOC_PTR, and OBD_CPT_ALLOC_GFP by
corresponding calls to kzalloc_node.  The semantic patch for the
OBD_CPT_ALLOC case is as follows: (http://coccinelle.lip6.fr/).

// <smpl>
@@ expression ptr,cptab,cpt,size; @@
- OBD_CPT_ALLOC(ptr, cptab, cpt, size)
+ ptr = kzalloc_node(size, GFP_NOFS, cfs_cpt_spread_node(cptab, cpt))
// </smpl>

Note that the original OBD macros would check if the cptab argument was
NULL and fall back on kzalloc in that case.  Oleg Drokin argues that this
test is not needed because the code containing these calls is only invoked
after initialization has been completed, in which case the possible cptab
arguments are not NULL.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: ptlrpc: service: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:37:47 +0000 (21:37 +0200)]
staging: lustre: ptlrpc: service: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);

@@ expression ptr; @@

- if (ptr != NULL) {
  kfree(ptr);
  ptr = NULL;
- }
// </smpl>

In the first case, specific labels are introduced to free only what is needed.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: ptlrpc: sec_plain: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:37:48 +0000 (21:37 +0200)]
staging: lustre: ptlrpc: sec_plain: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: ptlrpc: lproc_ptlrpc: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:37:49 +0000 (21:37 +0200)]
Staging: lustre: ptlrpc: lproc_ptlrpc: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

In the first case, the only cleanup needed is the unlock, so jump to that
directly.

Likewise, in the first two failure cases of ptlrpc_lprocfs_nrs_seq_write,
no cleanup is needed, so just drop the goto and return directly.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: osc: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:37:50 +0000 (21:37 +0200)]
Staging: lustre: osc: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: obdecho: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:37:51 +0000 (21:37 +0200)]
staging: lustre: obdecho: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: obdclass: obd_mount: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:37:52 +0000 (21:37 +0200)]
staging: lustre: obdclass: obd_mount: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);

@@ expression ptr; @@

- if (ptr != NULL) {
  kfree(ptr);
  ptr = NULL;
- }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: obdclass: obd_config: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:37:53 +0000 (21:37 +0200)]
staging: lustre: obdclass: obd_config: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that identifies this issue is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

The first part of the patch introduces new labels to avoid unnecessary
calls to kfree.  In addition, lprof->lp_md is always null in the cleanup
code at the end of the function, so that kfree is just dropped.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: obdclass: llog: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:37:54 +0000 (21:37 +0200)]
staging: lustre: obdclass: llog: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: obdclass: genops: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:37:55 +0000 (21:37 +0200)]
staging: lustre: obdclass: genops: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: mdc: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:37:56 +0000 (21:37 +0200)]
staging: lustre: mdc: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: lov: lov_dev: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:37:57 +0000 (21:37 +0200)]
staging: lustre: lov: lov_dev: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: lmv: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:37:58 +0000 (21:37 +0200)]
staging: lustre: lmv: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: llite: statahead: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:37:59 +0000 (21:37 +0200)]
staging: lustre: llite: statahead: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: llite: llite_lib: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:38:00 +0000 (21:38 +0200)]
Staging: lustre: llite: llite_lib: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: llite: file: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:38:01 +0000 (21:38 +0200)]
Staging: lustre: llite: file: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that finds this issue is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

In the first case, llss can never be null at the point of the kfree anyway.

In the second set of changes, the gotos are either eliminated, when no
freeing is needed (hss failure case), or rewritten so that there is no call
to free on data that has not yet been allocated (free_hss goto case).
There is no goto at which attr is not null, so the out label is simply
dropped.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: llite: dir: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:38:02 +0000 (21:38 +0200)]
Staging: lustre: llite: dir: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

This patch additionally simplifies one case where the free, and thus the
jump to the end of the function, is not needed.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: libcfs: linux: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:38:03 +0000 (21:38 +0200)]
staging: lustre: libcfs: linux: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL) {
  kfree(ptr);
  ptr = NULL;
- }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: ldlm: ldlm_resource: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:38:04 +0000 (21:38 +0200)]
staging: lustre: ldlm: ldlm_resource: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL) {
  kfree(ptr);
  ptr = NULL;
- }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: ldlm: ldlm_lock: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:38:05 +0000 (21:38 +0200)]
staging: lustre: ldlm: ldlm_lock: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: ldlm: ldlm_lib: remove unneeded null test before free
Julia Lawall [Fri, 1 May 2015 19:38:06 +0000 (21:38 +0200)]
staging: lustre: ldlm: ldlm_lib: remove unneeded null test before free

Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: ptlrpc: Use kzalloc and kfree
Julia Lawall [Fri, 1 May 2015 15:51:12 +0000 (17:51 +0200)]
staging: lustre: ptlrpc: Use kzalloc and kfree

Replace OBD_ALLOC, OBD_ALLOC_WAIT, OBD_ALLOC_PTR, and OBD_ALLOC_PTR_WAIT by
kalloc/kcalloc, and OBD_FREE and OBD_FREE_PTR by kfree.

A simplified version of the semantic patch that makes these changes is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr,size; @@
- OBD_ALLOC(ptr,size)
+ ptr = kzalloc(size, GFP_NOFS)

@@ expression ptr, size; @@
- OBD_FREE(ptr, size);
+ kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: osc: Use kzalloc and kfree
Julia Lawall [Fri, 1 May 2015 15:51:13 +0000 (17:51 +0200)]
staging: lustre: osc: Use kzalloc and kfree

Replace OBD_ALLOC, OBD_ALLOC_WAIT, OBD_ALLOC_PTR, and OBD_ALLOC_PTR_WAIT by
kalloc/kcalloc, and OBD_FREE and OBD_FREE_PTR by kfree.

A simplified version of the semantic patch that makes these changes is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr,size; @@
- OBD_ALLOC(ptr,size)
+ ptr = kzalloc(size, GFP_NOFS)

@@ expression ptr, size; @@
- OBD_FREE(ptr, size);
+ kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: obdecho: Use kzalloc and kfree
Julia Lawall [Fri, 1 May 2015 15:51:14 +0000 (17:51 +0200)]
staging: lustre: obdecho: Use kzalloc and kfree

Replace OBD_ALLOC, OBD_ALLOC_WAIT, OBD_ALLOC_PTR, and OBD_ALLOC_PTR_WAIT by
kalloc/kcalloc, and OBD_FREE and OBD_FREE_PTR by kfree.

A simplified version of the semantic patch that makes these changes is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr,size; @@
- OBD_ALLOC(ptr,size)
+ ptr = kzalloc(size, GFP_NOFS)

@@ expression ptr, size; @@
- OBD_FREE(ptr, size);
+ kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: obdclass: Use kzalloc and kfree
Julia Lawall [Fri, 1 May 2015 15:51:15 +0000 (17:51 +0200)]
staging: lustre: obdclass: Use kzalloc and kfree

Replace OBD_ALLOC, OBD_ALLOC_WAIT, OBD_ALLOC_PTR, and OBD_ALLOC_PTR_WAIT by
kalloc/kcalloc, and OBD_FREE and OBD_FREE_PTR by kfree.

A simplified version of the semantic patch that makes these changes is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr,size; @@
- OBD_ALLOC(ptr,size)
+ ptr = kzalloc(size, GFP_NOFS)

@@ expression ptr, size; @@
- OBD_FREE(ptr, size);
+ kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: mgc: Use kzalloc and kfree
Julia Lawall [Fri, 1 May 2015 15:51:16 +0000 (17:51 +0200)]
staging: lustre: mgc: Use kzalloc and kfree

Replace OBD_ALLOC, OBD_ALLOC_WAIT, OBD_ALLOC_PTR, and OBD_ALLOC_PTR_WAIT by
kalloc/kcalloc, and OBD_FREE and OBD_FREE_PTR by kfree.

A simplified version of the semantic patch that makes these changes is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr,size; @@
- OBD_ALLOC(ptr,size)
+ ptr = kzalloc(size, GFP_NOFS)

@@ expression ptr, size; @@
- OBD_FREE(ptr, size);
+ kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: mdc: Use kzalloc and kfree
Julia Lawall [Fri, 1 May 2015 15:51:17 +0000 (17:51 +0200)]
staging: lustre: mdc: Use kzalloc and kfree

Replace OBD_ALLOC, OBD_ALLOC_WAIT, OBD_ALLOC_PTR, and OBD_ALLOC_PTR_WAIT by
kalloc/kcalloc, and OBD_FREE and OBD_FREE_PTR by kfree.

A simplified version of the semantic patch that makes these changes is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr,size; @@
- OBD_ALLOC(ptr,size)
+ ptr = kzalloc(size, GFP_NOFS)

@@ expression ptr, size; @@
- OBD_FREE(ptr, size);
+ kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: lmv: Use kzalloc and kfree
Julia Lawall [Fri, 1 May 2015 15:51:18 +0000 (17:51 +0200)]
staging: lustre: lmv: Use kzalloc and kfree

Replace OBD_ALLOC, OBD_ALLOC_WAIT, OBD_ALLOC_PTR, and OBD_ALLOC_PTR_WAIT by
kalloc/kcalloc, and OBD_FREE and OBD_FREE_PTR by kfree.

A simplified version of the semantic patch that makes these changes is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr,size; @@
- OBD_ALLOC(ptr,size)
+ ptr = kzalloc(size, GFP_NOFS)

@@ expression ptr, size; @@
- OBD_FREE(ptr, size);
+ kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: ldlm: Use kzalloc and kfree
Julia Lawall [Fri, 1 May 2015 15:51:19 +0000 (17:51 +0200)]
staging: lustre: ldlm: Use kzalloc and kfree

Replace OBD_ALLOC, OBD_ALLOC_WAIT, OBD_ALLOC_PTR, and OBD_ALLOC_PTR_WAIT by
kalloc/kcalloc, and OBD_FREE and OBD_FREE_PTR by kfree.

A simplified version of the semantic patch that makes these changes is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr,size; @@
- OBD_ALLOC(ptr,size)
+ ptr = kzalloc(size, GFP_NOFS)

@@ expression ptr, size; @@
- OBD_FREE(ptr, size);
+ kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: lclient: Use kzalloc and kfree
Julia Lawall [Fri, 1 May 2015 15:51:20 +0000 (17:51 +0200)]
staging: lustre: lclient: Use kzalloc and kfree

Replace OBD_ALLOC, OBD_ALLOC_WAIT, OBD_ALLOC_PTR, and OBD_ALLOC_PTR_WAIT by
kalloc/kcalloc, and OBD_FREE and OBD_FREE_PTR by kfree.

A simplified version of the semantic patch that makes these changes is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr,size; @@
- OBD_ALLOC(ptr,size)
+ ptr = kzalloc(size, GFP_NOFS)

@@ expression ptr, size; @@
- OBD_FREE(ptr, size);
+ kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: fld: Use kzalloc and kfree
Julia Lawall [Fri, 1 May 2015 15:51:21 +0000 (17:51 +0200)]
Staging: lustre: fld: Use kzalloc and kfree

Replace OBD_ALLOC, OBD_ALLOC_WAIT, OBD_ALLOC_PTR, and OBD_ALLOC_PTR_WAIT by
kalloc/kcalloc, and OBD_FREE and OBD_FREE_PTR by kfree.

A simplified version of the semantic patch that makes these changes is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr,size; @@
- OBD_ALLOC(ptr,size)
+ ptr = kzalloc(size, GFP_NOFS)

@@ expression ptr, size; @@
- OBD_FREE(ptr, size);
+ kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: fid: Use kzalloc and kfree
Julia Lawall [Fri, 1 May 2015 15:51:22 +0000 (17:51 +0200)]
staging: lustre: fid: Use kzalloc and kfree

Replace OBD_ALLOC, OBD_ALLOC_WAIT, OBD_ALLOC_PTR, and OBD_ALLOC_PTR_WAIT by
kalloc/kcalloc, and OBD_FREE and OBD_FREE_PTR by kfree.

A simplified version of the semantic patch that makes these changes is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr,size; @@
- OBD_ALLOC(ptr,size)
+ ptr = kzalloc(size, GFP_NOFS)

@@ expression ptr, size; @@
- OBD_FREE(ptr, size);
+ kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: llite: fix ifnullfree.cocci warnings
kbuild test robot [Thu, 30 Apr 2015 16:21:55 +0000 (00:21 +0800)]
staging: lustre: llite: fix ifnullfree.cocci warnings

drivers/staging/lustre/lustre/llite/dir.c:1440:3-8: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

CC: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: llite: fix ifnullfree.cocci warnings
kbuild test robot [Thu, 30 Apr 2015 16:21:55 +0000 (00:21 +0800)]
staging: lustre: llite: fix ifnullfree.cocci warnings

drivers/staging/lustre/lustre/llite/llite_lib.c:989:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.
drivers/staging/lustre/lustre/llite/llite_lib.c:991:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

CC: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: fix ifnullfree.cocci warnings
kbuild test robot [Thu, 30 Apr 2015 16:27:35 +0000 (00:27 +0800)]
staging: lustre: fix ifnullfree.cocci warnings

drivers/staging/lustre/lustre/lov/lov_request.c:74:3-8: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

CC: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: fix ifnullfree.cocci warnings
kbuild test robot [Thu, 30 Apr 2015 16:27:35 +0000 (00:27 +0800)]
staging: lustre: fix ifnullfree.cocci warnings

drivers/staging/lustre/lustre/lov/lov_obd.c:574:3-8: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

CC: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: comedi: fix code indent coding style issues in daqboard2000.c
Gbenga Adalumo [Wed, 22 Apr 2015 07:39:48 +0000 (00:39 -0700)]
Staging: comedi: fix code indent coding style issues in daqboard2000.c

This is a patch to daqboard2000.c file that fixes  code indent errors found by the checkpatch.pl tool

Signed-off-by: Gbenga Adalumo <gbengadev@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: Remove unwanted lines of code
Gujulan Elango, Hari Prasath (H.) [Thu, 23 Apr 2015 19:14:21 +0000 (19:14 +0000)]
staging: comedi: Remove unwanted lines of code

This patch removes a few lines of code & retains the same functionality

Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: move COMEDI_SRF_... macros to "comedi_fops.c"
Ian Abbott [Tue, 21 Apr 2015 12:18:11 +0000 (13:18 +0100)]
staging: comedi: move COMEDI_SRF_... macros to "comedi_fops.c"

The `COMEDI_SRF_...` macros define flag combinations in the `runflags`
member of `struct comedi_subdevice`.  They are only used directly in
"comedi_fops.c", so move them to there.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: wrap COMEDI_SRF_FREE_SPRIV usage
Ian Abbott [Tue, 21 Apr 2015 12:18:10 +0000 (13:18 +0100)]
staging: comedi: wrap COMEDI_SRF_FREE_SPRIV usage

The `COMEDI_SRF_FREE_SPRIV` flag in the `runflags` member of `struct
comedi_subdevice` indicates that the memory pointed to by the `private`
member can be automatically freed by the comedi core on subdevice
clean-up (when the low-level comedi device is being "detached").  the
flag doesn't really belong in `runflags`, but it was somewhere
convenient to keep it without having to add a new member to the
structure.

Rather than access the `COMEDI_SRF_FREE_SPRIV` flag directly, use some
new wrapper functions:

* comedi_can_auto_free_spriv(s) - checks whether the subdevice's
  `s->private` points to memory that can be freed automatically.
* comedi_set_spriv_auto_free(s) - marks the subdevice as having a
  `s->private` that points to memory that can be freed automatically.

Export `comedi_set_spriv_auto_free()` for use by the low-level comedi
driver modules, in particular the "amplc_dio200_common" module.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: serial2002: fix Coverity "Explicit null dereference"
H Hartley Sweeten [Mon, 20 Apr 2015 18:49:06 +0000 (11:49 -0700)]
staging: comedi: serial2002: fix Coverity "Explicit null dereference"

serial2002_setup_subdevices() initializes each subdevice based on the
config read from the attached serial device. Part of this initialization
is to setup the subdevice range_table_list for the non digital subdevices.
The range_table_list is allocated only when a 'range' is passed to the
functions. Each channel of the subdevice then has it's 'range' initialized
and that range is added to the range_table_list.

The logic of this function works but causes Coverity complain about an
Explicit null dereference of the allocated 'range_table_list'. Add a check
for the 'range_table_list' to quiet the Coverity issue.

Reported-by: coverity (CID 1011632)
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_nio_common: don't write non-existing caldac's
H Hartley Sweeten [Mon, 20 Apr 2015 18:49:05 +0000 (11:49 -0700)]
staging: comedi: ni_nio_common: don't write non-existing caldac's

ni_write_caldac() checks the boardinfo 'caldac' array to determine what
caldac is used for a given 'addr'. It then calculates the 'bitstring' and
number of 'bits' used to write a value to that caldac address.

After checking the caldac array, if the number of bits is 0 there is no
caldac associated with the address. If this happens we shouldn't try
writing to the non-existing caldac.

Reported-by: coverity (CID 1192116)
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: comedi_bond: fix 'b_mask' calc in bonding_dio_insn_bits()
H Hartley Sweeten [Mon, 20 Apr 2015 18:49:04 +0000 (11:49 -0700)]
staging: comedi: comedi_bond: fix 'b_mask' calc in bonding_dio_insn_bits()

'b_chans' may be a valud up to 32. 'b_mask' is an unsigned int and a left shift of
more than 31 bits has undefined behavior. Fix the calc so it works correctly with
a 'b_chans' of 32..

Reported-by: coverity (CID 1192244)
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: comedi: daqboard2000.c fixed trailing whitespace
Andrei Maresu [Thu, 9 Apr 2015 20:29:31 +0000 (23:29 +0300)]
Staging: comedi: daqboard2000.c fixed trailing whitespace

Fixed a coding style issue.

Signed-off-by: Andrei Maresu <andreimaresu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: panel: remove duplicate code
Sudip Mukherjee [Tue, 7 Apr 2015 08:25:01 +0000 (13:55 +0530)]
staging: panel: remove duplicate code

both the misc_deregister(), parport_release() and
parport_unregister_device() is there in the module_exit function also.
detach is called from parport_unregister_driver() and by the time
detach executes misc_deregister(), parport_release() and
parport_unregister_device() has already executed marking
keypad_initialized and lcd.initialized  as false. so this part of the
code will never execute.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: update boilerplate comments
Aaro Koskinen [Sat, 4 Apr 2015 19:51:21 +0000 (22:51 +0300)]
staging: octeon-ethernet: update boilerplate comments

Update boilerplate comments to be more terse by removing
redundant information.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: eliminate OCTEON_ETHERNET_VERSION
Aaro Koskinen [Sat, 4 Apr 2015 19:51:20 +0000 (22:51 +0300)]
staging: octeon-ethernet: eliminate OCTEON_ETHERNET_VERSION

This driver has drifted away from out-of-tree versions years ago
and the version string does not provide any useful information.
Instead provide the kernel version string to ethtool, so that we get
useful version information e.g. for bug reports.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: eliminate DONT_WRITEBACK
Aaro Koskinen [Sat, 4 Apr 2015 19:51:19 +0000 (22:51 +0300)]
staging: octeon-ethernet: eliminate DONT_WRITEBACK

This feature is not used so eliminate it.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: eliminate USE_RED define
Aaro Koskinen [Sat, 4 Apr 2015 19:51:18 +0000 (22:51 +0300)]
staging: octeon-ethernet: eliminate USE_RED define

We have RED always enabled, so eliminate the #define.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: eliminate USE_SKBUFFS_IN_HW define
Aaro Koskinen [Sat, 4 Apr 2015 19:51:17 +0000 (22:51 +0300)]
staging: octeon-ethernet: eliminate USE_SKBUFFS_IN_HW define

We always try to use skbuffs for packet buffers, so eliminate
a redundant define.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: eliminate USE_HW_TCPUDP_CHECKSUM define
Aaro Koskinen [Sat, 4 Apr 2015 19:51:16 +0000 (22:51 +0300)]
staging: octeon-ethernet: eliminate USE_HW_TCPUDP_CHECKSUM define

HW checksum is always enabled, so delete a redundant define.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: eliminate USE_10MBPS_PREAMBLE_WORKAROUND define
Aaro Koskinen [Sat, 4 Apr 2015 19:51:15 +0000 (22:51 +0300)]
staging: octeon-ethernet: eliminate USE_10MBPS_PREAMBLE_WORKAROUND define

We have the workaround always enabled, so eliminate a redundant #define.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: delete references to CONFIG_CAVIUM_RESERVE32
Aaro Koskinen [Sat, 4 Apr 2015 19:51:14 +0000 (22:51 +0300)]
staging: octeon-ethernet: delete references to CONFIG_CAVIUM_RESERVE32

Delete references to CONFIG_CAVIUM_RESERVE32. Kernel does not have such
option and the driver does not use it for anything.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: spi: refactor spx block interrupt handling
Aaro Koskinen [Sat, 4 Apr 2015 19:51:13 +0000 (22:51 +0300)]
staging: octeon-ethernet: spi: refactor spx block interrupt handling

Code for spx1 and spx0 block are identical, move it into a function.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: spi: move stx interrupt dumps into a function
Aaro Koskinen [Sat, 4 Apr 2015 19:51:12 +0000 (22:51 +0300)]
staging: octeon-ethernet: spi: move stx interrupt dumps into a function

Move interrupt printouts into a common function to avoid copy paste.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: spi: move spx interrupt dumps into a function
Aaro Koskinen [Sat, 4 Apr 2015 19:51:11 +0000 (22:51 +0300)]
staging: octeon-ethernet: spi: move spx interrupt dumps into a function

Move interrupt printouts into a common function to avoid copy paste.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: rgmii: use function to configure hw preamble
Aaro Koskinen [Sat, 4 Apr 2015 19:51:10 +0000 (22:51 +0300)]
staging: octeon-ethernet: rgmii: use function to configure hw preamble

Use a function to enable/disable HW preamble checking to avoid copy paste.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: rgmii: refactor gmx block interrupt handling
Aaro Koskinen [Sat, 4 Apr 2015 19:51:09 +0000 (22:51 +0300)]
staging: octeon-ethernet: rgmii: refactor gmx block interrupt handling

Code for gmx0 and gmx1 block is identical, move it into a function.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: sgmii/xaui: make link poll generic
Aaro Koskinen [Sat, 4 Apr 2015 19:51:08 +0000 (22:51 +0300)]
staging: octeon-ethernet: sgmii/xaui: make link poll generic

Make link poll generic to avoid copy paste.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: consolidate carrier notifications
Aaro Koskinen [Sat, 4 Apr 2015 19:51:07 +0000 (22:51 +0300)]
staging: octeon-ethernet: consolidate carrier notifications

Always use cvm_oct_note_carrier() to avoid copy-pasted code.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: add queue information to carrier note
Aaro Koskinen [Sat, 4 Apr 2015 19:51:06 +0000 (22:51 +0300)]
staging: octeon-ethernet: add queue information to carrier note

Add queue information to carrier note.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: delete sgmii and xaui specific uninit functions
Aaro Koskinen [Sat, 4 Apr 2015 19:51:05 +0000 (22:51 +0300)]
staging: octeon-ethernet: delete sgmii and xaui specific uninit functions

Delete redundant wrappers.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: move ndo_stop to common init
Aaro Koskinen [Sat, 4 Apr 2015 19:51:04 +0000 (22:51 +0300)]
staging: octeon-ethernet: move ndo_stop to common init

All init functions call ndo_stop if it's defined, so move it
to common function.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: consolidate ndo_stop functions
Aaro Koskinen [Sat, 4 Apr 2015 19:51:03 +0000 (22:51 +0300)]
staging: octeon-ethernet: consolidate ndo_stop functions

All ndo_stop functions are identical. Get rid of duplicated code.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-ethernet: consolidate ndo_open functions
Aaro Koskinen [Sat, 4 Apr 2015 19:51:02 +0000 (22:51 +0300)]
staging: octeon-ethernet: consolidate ndo_open functions

ndo_open for rgmii, sgmii and xaui are almost identical. Put the common
code in a single function.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: vt6655: device_intr check for vif on while loop
Malcolm Priestley [Mon, 6 Apr 2015 20:19:48 +0000 (21:19 +0100)]
staging: vt6655: device_intr check for vif on while loop

vif should never be or go null while in loop.

Fixes race condition where interrupts are late and when
interface is not present.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoiio: example code is buggy
Alan [Wed, 8 Apr 2015 19:24:43 +0000 (20:24 +0100)]
iio: example code is buggy

Shock horror, example template code that has never been used in reality is
in fact a hazard. This fixes the obvious bug, probably these kind of
"examples" should be deleted so real (working) examples are followed.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: emxx_udc: Remove dead code
Gujulan Elango, Hari Prasath (H.) [Thu, 23 Apr 2015 19:30:53 +0000 (19:30 +0000)]
staging: emxx_udc: Remove dead code

This patch removes few lines of commented code.

Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: emxx_udc : remove stray semicolon
Gujulan Elango, Hari Prasath (H.) [Thu, 23 Apr 2015 19:29:51 +0000 (19:29 +0000)]
staging: emxx_udc : remove stray semicolon

This patch removes a stray semicolon around closing brace of an if code
block.

Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: emxx_udc: test returned value
Julia Lawall [Sat, 4 Apr 2015 14:59:30 +0000 (16:59 +0200)]
staging: emxx_udc: test returned value

Put NULL test on the result of the previous call instead on one of its
arguments.  A simplified version of the semantic match that finds this
problem is as follows (http://coccinelle.lip6.fr/):

// <smpl>
r@
expression *e1;
expression *e2;
identifier f;
statement S1,S2;
@@

e1 = f(...,e2,...);
(
if (e1 == NULL || ...) S1 else S2
|
*if (e2 == NULL || ...) S1 else S2
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: fbtft: fix header guard typo
Nicolas Iooss [Fri, 17 Apr 2015 09:41:43 +0000 (17:41 +0800)]
Staging: fbtft: fix header guard typo

drivers/staging/fbtft/internal.h header guard tests for
__LINUX_FBTFT__INTERNAL_H but then defines __LINUX_FBTFT_INTERNAL_H
(only 1 underscore) and uses the same name for the #endif comment.
Use the same name everywhere.

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: Disable DMA support if DMA is not available
Geert Uytterhoeven [Fri, 24 Apr 2015 07:44:15 +0000 (09:44 +0200)]
staging: fbtft: Disable DMA support if DMA is not available

If NO_DMA=y:

    drivers/built-in.o: In function `fbtft_framebuffer_alloc':
    (.text+0xb53cae): undefined reference to `dmam_alloc_coherent'

As DMA support is already optional, make it depend on HAS_DMA.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: Add a blank line after declarations
Charlie Wong Super [Sat, 4 Apr 2015 12:54:56 +0000 (20:54 +0800)]
staging: fbtft: Add a blank line after declarations

scripts/checkpatch.pl WARNING: Missing a blank line after declarations

Signed-off-by: Charlie Wong Super <1213charlie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: Replace spaces to tab
Charlie Wong Super [Sat, 4 Apr 2015 11:30:28 +0000 (19:30 +0800)]
staging: fbtft: Replace spaces to tab

Spaces at the start of the line, replace the leading space to tabs

Signed-off-by: Charlie Wong Super <1213charlie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: remove uislib module from staging tree
Benjamin Romer [Tue, 14 Apr 2015 01:16:51 +0000 (21:16 -0400)]
staging: unisys: remove uislib module from staging tree

This module is being removed completely, because it contained wrapper functions
and utility functions that were used in virtpci and virthba. Since these two
drivers are being rewritten to not use these wrappers and utilities, uislib
needs to go.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Reviewed-by: Don Zickus <dzickus@redhat.com>
Reviewed-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: remove virtpci driver from staging tree
Benjamin Romer [Tue, 14 Apr 2015 01:16:50 +0000 (21:16 -0400)]
staging: unisys: remove virtpci driver from staging tree

The virtpci driver is being rewritten, so remove the driver from the staging
tree.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Reviewed-by: Don Zickus <dzickus@redhat.com>
Reviewed-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: remove virthba driver for rewrite
Benjamin Romer [Tue, 14 Apr 2015 01:16:49 +0000 (21:16 -0400)]
staging: unisys: remove virthba driver for rewrite

The virthba driver is being rewritten and will be renamed to visorhba, so delete
the old driver from the source tree.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Reviewed-by: Don Zickus <dzickus@redhat.com>
Reviewed-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: visorchipset: Get rid of ulong usage
Jes Sorensen [Mon, 13 Apr 2015 14:28:44 +0000 (10:28 -0400)]
staging: unisys: visorchipset: Get rid of ulong usage

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Tested-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: visorchipset: Remove unused get_channel_info notifier
Jes Sorensen [Mon, 13 Apr 2015 14:28:43 +0000 (10:28 -0400)]
staging: unisys: visorchipset: Remove unused get_channel_info notifier

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Tested-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: visorchipset: Use correct type for dev_no
Jes Sorensen [Mon, 13 Apr 2015 14:28:42 +0000 (10:28 -0400)]
staging: unisys: visorchipset: Use correct type for dev_no

visorchipset_bus_info.dev_no is only assigned the value of
controlvm_message_packet.create_bus.dev_count, which is a u32. No
point promoting it to a u64.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Tested-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: visorchipset: Do not use confuse size of long with size of u32
Jes Sorensen [Mon, 13 Apr 2015 14:28:41 +0000 (10:28 -0400)]
staging: unisys: visorchipset: Do not use confuse size of long with size of u32

struct visorcipset_device_info defines bus_no and dev_no as u32, while
the deprecated ulong type is 64 bits. Hence avoid promoting the values
to 64 bit just to truncate them again later.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Tested-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: visorchipset: Get rid of ugly BOOL/TRUE/FALSE usage
Jes Sorensen [Mon, 13 Apr 2015 14:28:40 +0000 (10:28 -0400)]
staging: unisys: visorchipset: Get rid of ugly BOOL/TRUE/FALSE usage

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Tested-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: visorchipset: Avoid struct typedef abuse
Jes Sorensen [Mon, 13 Apr 2015 14:28:39 +0000 (10:28 -0400)]
staging: unisys: visorchipset: Avoid struct typedef abuse

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Tested-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: visorchipset: Remove unused NONULLSTR()
Jes Sorensen [Mon, 13 Apr 2015 14:28:38 +0000 (10:28 -0400)]
staging: unisys: visorchipset: Remove unused NONULLSTR()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Tested-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: fix kdump support
Benjamin Romer [Mon, 6 Apr 2015 14:27:40 +0000 (10:27 -0400)]
staging: unisys: fix kdump support

The s-Par drivers used to be out-of-tree, so they needed a parameter to
let them know we were going into a dump. This patch removes that code
and uses the built-in kernel function instead.

Reviewed-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging : unisys: Fix brace coding style issue
Andreas Theodosiou [Sat, 4 Apr 2015 23:09:30 +0000 (02:09 +0300)]
staging : unisys: Fix brace coding style issue

This is a patch to visorchannel/visorchannel_funcs.c that fixes a couple
of brace warnings found by checkpatch.pl.

Signed-off-by: Andreas Theodosiou <andreasabu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: Make struct mdc_kuc_fops static
Dzmitry Sledneu [Sat, 18 Apr 2015 13:20:43 +0000 (15:20 +0200)]
staging: lustre: Make struct mdc_kuc_fops static

This patch fixes the following Sparse warning:
"symbol 'mdc_kuc_fops' was not declared. Should it be static?".

Signed-off-by: Dzmitry Sledneu <dzmitry.sledneu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: drop uses of some OBD alloc and free functions
Julia Lawall [Sun, 12 Apr 2015 21:34:20 +0000 (23:34 +0200)]
staging: lustre: drop uses of some OBD alloc and free functions

Replace OBD_ALLOC, OBD_ALLOC_WAIT, OBD_ALLOC_PTR, and OBD_ALLOC_PTR_WAIT by
kzalloc or calloc, as appropriate.

Replace OBD_FREE and OBD_FREE_PTR by kfree.

A simplified version of the semantic patch that makes these changes in the
OBD_ALLOC/FREE case is as follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression ptr,e1,e2;
@@
- OBD_ALLOC(ptr,sizeof e1 * e2)
+ ptr = kcalloc(e2, sizeof e1, GFP_NOFS)

@@
expression ptr,size;
@@
- OBD_ALLOC(ptr,size)
+ ptr = kzalloc(size, GFP_NOFS)

@@
expression ptr, size;
@@
- OBD_FREE(ptr, size);
+ kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: llite: drop uses of OBD free functions
Julia Lawall [Sun, 12 Apr 2015 20:55:02 +0000 (22:55 +0200)]
staging: lustre: llite: drop uses of OBD free functions

Replace OBD_FREE and OBD_FREE_PTR by kfree.

The semantic patch that makes these changes is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression ptr, size;
@@

- OBD_FREE(ptr, size);
+ kfree(ptr);

@@
expression ptr;
@@

- OBD_FREE_PTR(ptr);
+ kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: llite: remove obsolete conditional code
Andreas Dilger [Wed, 8 Apr 2015 23:24:02 +0000 (17:24 -0600)]
staging: lustre: llite: remove obsolete conditional code

Remove conditional flock/aops code that was only for out-of-tree
vendor kernels but is not relevant for in-kernel code.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoi2o: fix simple_return.cocci warnings
kbuild test robot [Thu, 30 Apr 2015 13:03:04 +0000 (21:03 +0800)]
i2o: fix simple_return.cocci warnings

drivers/staging/i2o/iop.c:777:1-3: WARNING: end returns can be simpified

 Simplify a trivial if-return sequence.  Possibly combine with a
 preceding function call.
Generated by: scripts/coccinelle/misc/simple_return.cocci

CC: Alan Cox <alan@linux.intel.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: i2o: Remove unwanted semicolon
Gujulan Elango, Hari Prasath (H.) [Thu, 23 Apr 2015 13:43:01 +0000 (13:43 +0000)]
staging: i2o: Remove unwanted semicolon

This patch removes unwanted semicolon around close braces of code blocks

Signed-off-by: Hari Prasath <hgujulan@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iop.c: move assignment out of if () block
Greg Kroah-Hartman [Wed, 29 Apr 2015 14:21:59 +0000 (16:21 +0200)]
Staging: iop.c: move assignment out of if () block

We should not be doing assignments within an if () block
so fix up the code to not do this.

change was created using Coccinelle.

CC: Supriya Karanth <iskaranth@gmail.com>
CC: Somya Anand <somyaanand214@gmail.com>
CC: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: octeon-usb: fix unaligned isochronous transfers
Johan Hovold [Thu, 23 Apr 2015 14:06:52 +0000 (16:06 +0200)]
staging: octeon-usb: fix unaligned isochronous transfers

Make sure to copy the whole transfer buffer when releasing the temporary
buffer used for unaligned isochronous transfers as the data is not
necessarily contiguous in that case.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoLinux 4.1-rc1
Linus Torvalds [Mon, 27 Apr 2015 00:59:10 +0000 (17:59 -0700)]
Linux 4.1-rc1

9 years agox86_64, asm: Work around AMD SYSRET SS descriptor attribute issue
Andy Lutomirski [Sun, 26 Apr 2015 23:47:59 +0000 (16:47 -0700)]
x86_64, asm: Work around AMD SYSRET SS descriptor attribute issue

AMD CPUs don't reinitialize the SS descriptor on SYSRET, so SYSRET with
SS == 0 results in an invalid usermode state in which SS is apparently
equal to __USER_DS but causes #SS if used.

Work around the issue by setting SS to __KERNEL_DS __switch_to, thus
ensuring that SYSRET never happens with SS set to NULL.

This was exposed by a recent vDSO cleanup.

Fixes: e7d6eefaaa44 x86/vdso32/syscall.S: Do not load __USER32_DS to %ss
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Peter Anvin <hpa@zytor.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agoMerge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Linus Torvalds [Mon, 27 Apr 2015 00:55:26 +0000 (17:55 -0700)]
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull intel drm fixes from Dave Airlie.

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
  drm/i915: vlv: fix save/restore of GFX_MAX_REQ_COUNT reg
  drm/i915: Workaround to avoid lite restore with HEAD==TAIL
  drm/i915: cope with large i2c transfers

9 years agoMerge git://git.infradead.org/intel-iommu
Linus Torvalds [Mon, 27 Apr 2015 00:47:46 +0000 (17:47 -0700)]
Merge git://git.infradead.org/intel-iommu

Pull intel iommu updates from David Woodhouse:
 "This lays a little of the groundwork for upcoming Shared Virtual
  Memory support — fixing some bogus #defines for capability bits and
  adding the new ones, and starting to use the new wider page tables
  where we can, in anticipation of actually filling in the new fields
  therein.

  It also allows graphics devices to be assigned to VM guests again.
  This got broken in 3.17 by disallowing assignment of RMRR-afflicted
  devices.  Like USB, we do understand why there's an RMRR for graphics
  devices — and unlike USB, it's actually sane.  So we can make an
  exception for graphics devices, just as we do USB controllers.

  Finally, tone down the warning about the X2APIC_OPT_OUT bit, due to
  persistent requests.  X2APIC_OPT_OUT was added to the spec as a nasty
  hack to allow broken BIOSes to forbid us from using X2APIC when they
  do stupid and invasive things and would break if we did.

  Someone noticed that since Windows doesn't have full IOMMU support for
  DMA protection, setting the X2APIC_OPT_OUT bit made Windows avoid
  initialising the IOMMU on the graphics unit altogether.

  This means that it would be available for use in "driver mode", where
  the IOMMU registers are made available through a BAR of the graphics
  device and the graphics driver can do SVM all for itself.

  So they started setting the X2APIC_OPT_OUT bit on *all* platforms with
  SVM capabilities.  And even the platforms which *might*, if the
  planets had been aligned correctly, possibly have had SVM capability
  but which in practice actually don't"

* git://git.infradead.org/intel-iommu:
  iommu/vt-d: support extended root and context entries
  iommu/vt-d: Add new extended capabilities from v2.3 VT-d specification
  iommu/vt-d: Allow RMRR on graphics devices too
  iommu/vt-d: Print x2apic opt out info instead of printing a warning
  iommu/vt-d: kill bogus ecap_niotlb_iunits()

9 years agoMerge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
Linus Torvalds [Mon, 27 Apr 2015 00:44:09 +0000 (17:44 -0700)]
Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "This has a mixture of merge window cleanups and bugfixes"

* 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: st: add include for pinctrl
  i2c: mux: use proper dev when removing "channel-X" symlinks
  i2c: digicolor: remove duplicate include
  i2c: Mark adapter devices with pm_runtime_no_callbacks
  i2c: pca-platform: fix broken email address
  i2c: mxs: fix broken email address
  i2c: rk3x: report number of messages transmitted