]>
git.karo-electronics.de Git - linux-beck.git/log
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>
Sudip Mukherjee [Sat, 27 Feb 2016 12:03:33 +0000 (17:33 +0530)]
staging: dgnc: remove pci_unregister_driver
If pci_register_driver() fails then dgnc_NumBoards can never be more
than zero. dgnc_NumBoards is incremented only at the end of a successful
probe. And moreover if the pci driver has failed to register then we
never need to unregister it. Lets just print the warning, perform the
cleanup and exit with the error code.
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:32 +0000 (17:33 +0530)]
staging: dgnc: remove unneeded else
If pci_enable_device() fails then we can return directly.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rehas Sachdeva [Fri, 26 Feb 2016 15:59:41 +0000 (21:29 +0530)]
staging: dgnc: Break line after boolean operator
The preferred way to break up long math lines is to break after an arthimetic
or boolean operator. This patch fixes the checkpatch.pl warning:
Logical continuations should be on the previous line.
Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rehas Sachdeva [Fri, 26 Feb 2016 15:59:20 +0000 (21:29 +0530)]
staging: dgnc: Fix block comment style
This patch fixes the block comment style.
1. The checkpatch.pl warning:
Block comments use a trailing */ on a separate line.
2. '====' separator is unnecessary and should not be used.
Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rehas Sachdeva [Fri, 26 Feb 2016 15:57:16 +0000 (21:27 +0530)]
staging: dgnc: Avoid multiple blank lines
This patch fixes 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>
Rehas Sachdeva [Fri, 26 Feb 2016 15:56:43 +0000 (21:26 +0530)]
staging: dgnc: Add spaces around '|' and '<<'
One space on either side of binary and ternary operators is preferred.
This patch fixes the related checkpatch.pl warnings.
Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Eva Rachel Retuya [Tue, 23 Feb 2016 16:34:56 +0000 (00:34 +0800)]
staging: dgnc: delete parentheses around right hand side of assignment
Eliminate unneeded parentheses around the right hand side of an
assignment. Coccinelle semantic patch used:
@@
expression e1, e2;
identifier v;
@@
(
v = (e1 == e2)
|
v = (e1 != e2)
|
v = (e1 <= e2)
|
v = (e1 >= e2)
|
v =
- (
e1
- )
)
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Mon, 22 Feb 2016 20:22:33 +0000 (01:52 +0530)]
staging: vme: devices: Replace kzalloc with devm_kzalloc
Devm_ functions allocate memory that is released when a driver
detaches. Replace kzalloc with devm_kzalloc and remove corresponding
kfrees from probe and remove functions of a platform
device.
Also, unnecessary labels have been removed.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Janani Ravichandran [Thu, 25 Feb 2016 18:44:39 +0000 (13:44 -0500)]
staging: fbtft: fb_uc1611.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>
Janani Ravichandran [Thu, 25 Feb 2016 18:39:55 +0000 (13:39 -0500)]
staging: fbtft: fb_ra8875.c: Remove 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 18:34:28 +0000 (13:34 -0500)]
staging: fbtft: fbtft-bus.c: Drop unneeded void pointer cast
Remove unneeded cast on the void pointer par->txbuf.buf .
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 [Thu, 25 Feb 2016 13:20:58 +0000 (18:50 +0530)]
staging: fbtft: 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,E4;
@@
- devm_kzalloc(dev,E1*E2*sizeof(E3),E4)
+ devm_kcalloc(dev,E1*E2,sizeof(E3),E4)
//</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 05:37:28 +0000 (11:07 +0530)]
staging: fbtft: Remove unnecessary spi_set_drvdata()
Unnecessary spi_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:
@@
struct spi_device *spi;
@@
- spi_set_drvdata(spi, NULL);
// </smpl>
Due to this removal, variable `spi` was unused so dropped `spi`
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alison Schofield [Wed, 24 Feb 2016 17:20:17 +0000 (09:20 -0800)]
staging: fbtft: replace ternary operator with min macro
Use macro min() to get the minimum of two values for
brevity and readability.
Found using Coccinelle:
@@ type T; T x; T y; @@
(
- x < y ? x : y
+ min(x,y)
|
- x > y ? x : y
+ max(x,y)
)
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Mon, 22 Feb 2016 17:47:16 +0000 (23:17 +0530)]
staging: fbtft: Use kmalloc_array
Use kmalloc_array instead of kmalloc for arrays to prevent integer
overflows.
This was done using Coccinelle:
@@
expression e1, e2;
constant C;
type t;
@@
(
- kmalloc(
+ kmalloc_array(
e2
- *
+ ,
sizeof(e1), C)
|
- kmalloc(
+ kmalloc_array(
e1
- *
+ ,
sizeof(t), C)
|
- kmalloc(
+ kmalloc_array(
- sizeof(e1)
- *
e2
+ ,
+ sizeof(e1)
, C)
|
- kmalloc(
+ kmalloc_array(
- sizeof(t)
- *
e1
+ ,
+ sizeof(t)
, C)
)
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ben Marsh [Thu, 10 Mar 2016 20:24:59 +0000 (21:24 +0100)]
Staging: nvec: removes an unnecessary cast on a void pointer
Patch to nvec_ps2.c to remove an unnecessary cast on a void pointer.
Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Janani Ravichandran [Thu, 25 Feb 2016 20:17:38 +0000 (15:17 -0500)]
staging: nvec: nvec.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>
Laura Garcia Liebana [Wed, 24 Feb 2016 17:11:07 +0000 (18:11 +0100)]
staging: nvec: Avoid the use of BUG_ON
Prevent a kernel panic by avoiding the use of the BUG_ON macro.
Checkpatch detected this issue.
The BUG_ON macro is not needed as such cases shouldn't happen and they
were introduced for debugging purposes.
Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Garcia Liebana [Mon, 22 Feb 2016 17:51:23 +0000 (18:51 +0100)]
staging: nvec: Remove blank lines before a close brace
Blank lines aren't necessary before a close brace '}'. Checkpatch
detected this issue.
Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhumika Goyal [Fri, 11 Mar 2016 10:23:56 +0000 (15:53 +0530)]
Staging: rtl8188eu: Remove function rtw_freq2ch
Remove function rtw_freq2ch as it is never used anywhere in the kernel.
Also, remove the function prototype.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Claudiu Beznea [Fri, 11 Mar 2016 10:18:48 +0000 (12:18 +0200)]
Staging: rtl8188eu: removed unnecessary check in core/rtw_ap.c
This patch removes unnecessary "if (true)" check in update_BCNTIM()
from core/rtw_ap.c file. After this remove the code alignment was
necessary.
Signed-off-by: Claudiu Beznea <claudiu.beznea@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Thu, 10 Mar 2016 16:54:07 +0000 (22:24 +0530)]
staging: rtl8188eu: os_dep: 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>
Sandhya Bankar [Mon, 7 Mar 2016 12:33:58 +0000 (18:03 +0530)]
Staging: rtl8188eu: Use !x instead of x==NULL.
Use !x instead of x==NULL.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sandhya Bankar [Mon, 7 Mar 2016 12:18:16 +0000 (17:48 +0530)]
Staging: rtl8188eu: rtw_efuse: 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 12:11:41 +0000 (17:41 +0530)]
Staging: rtl8188eu: 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>
Kyle Kuffermann [Sun, 6 Mar 2016 15:47:15 +0000 (10:47 -0500)]
rtl8188eu: Add spaces around arithmetic operators
This fixes the checkpatch.pl issue: CHECK: spaces preferred around that '+'
Signed-off-by: Kyle Kuffermann <kyle.kuffermann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivan Safonov [Wed, 2 Mar 2016 08:09:02 +0000 (15:09 +0700)]
staging: rtl8188eu: remove PWR_BASEADDR_* macro definitions and "base" member of wl_pwr_cfg structure
These macros and "base" member of wl_pwr_cfg structure
are used only to produce debug output.
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivan Safonov [Wed, 2 Mar 2016 08:07:46 +0000 (15:07 +0700)]
staging: rtl8188eu: remove PWR_INTF_*_MSK macro definitions and interface_mask of wl_pwr_cfg structure
This driver is intended only for usb devices.
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivan Safonov [Wed, 2 Mar 2016 08:07:09 +0000 (15:07 +0700)]
staging: rtl8188eu: remove PWR_FAB_*_MSK macro definitions and fab_msk of wl_pwr_cfg structure
fab_msk used for marking commands
for devices of a certain manufacturer.
However, always used only PWR_FAB_ALL_MSK value of fab_msk.
Most likely, such mark is useless.
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivan Safonov [Wed, 2 Mar 2016 08:06:26 +0000 (15:06 +0700)]
staging: rtl8188eu: remove FabVersion member of odm_dm_struct struct
Value of this variable is hardcoded
and used only to produce debug output.
Probably, FabVersion is useless.
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivan Safonov [Wed, 2 Mar 2016 08:05:47 +0000 (15:05 +0700)]
staging: rtl8188eu: remove chip_type of the adapter structure
chip_type variable is unnecessary here,
because this driver is only for one chip
and it is not used after initialization.
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivan Safonov [Wed, 2 Mar 2016 08:04:57 +0000 (15:04 +0700)]
staging: rtl8188eu: replace (a == NULL) to (!a) in rtw_drv_init
It is a checkpatch cleanups:
CHECK: Comparasion to NULL could be written ...
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivan Safonov [Wed, 2 Mar 2016 08:04:19 +0000 (15:04 +0700)]
staging: rtl8188eu: remove unnecessary debug output from os_dep/usb_intf.c
Debug output in rtw_drw_init is excess
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivan Safonov [Wed, 2 Mar 2016 08:01:33 +0000 (15:01 +0700)]
staging: rtl8188eu: remove unused macros from include/basic_types.h
FIELD_OFFSET, READEF1BYTE, READEF2BYTE, READEF4BYTE
WRITEEF1BYTE, WRITEEF2BYTE, WRITEEF4BYTE are removed.
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivan Safonov [Wed, 2 Mar 2016 08:00:30 +0000 (15:00 +0700)]
staging: rtl8188eu: remove unused include/ieee80211_ext.h
This file is not used for the driver compiling
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivan Safonov [Wed, 2 Mar 2016 07:59:01 +0000 (14:59 +0700)]
staging: rtl8188eu: FIELD_OFFSET macro replaced by offsetof macro
FIELD_OFFSET and offsetof macro are equal
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Sun, 28 Feb 2016 20:30:17 +0000 (02:00 +0530)]
staging: rtl8188eu: os_dep: Remove NULL test before vfree
vfree frees the virtually continuous memory area starting at addr.
If addr is NULL, no operation is performed. So NULL test is not needed
before vfree.
This was done using Coccinelle:
@@
expression x;
@@
-if (x != NULL)
vfree(x);
@@
expression x;
@@
-if (x != NULL) {
vfree(x);
x = NULL;
-}
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Sun, 28 Feb 2016 20:29:20 +0000 (01:59 +0530)]
staging: rtl8188eu: core: Remove NULL test before vfree
vfree frees the virtually continuous memory area starting at addr.
If addr is NULL, no operation is performed. So NULL test is not needed
before vfree.
This was done using Coccinelle:
@@
expression x;
@@
-if (x != NULL)
vfree(x);
@@
expression x;
@@
-if (x != NULL) {
vfree(x);
x = NULL;
-}
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Fri, 26 Feb 2016 09:41:07 +0000 (15:11 +0530)]
staging: rtl8188eu: core: 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>
Bhaktipriya Shridhar [Fri, 26 Feb 2016 09:40:18 +0000 (15:10 +0530)]
staging: rtl8188eu: os_dep: 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>
Bhaktipriya Shridhar [Thu, 25 Feb 2016 12:41:35 +0000 (18:11 +0530)]
staging: rtl8188eu: core: 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 [Tue, 23 Feb 2016 21:27:06 +0000 (02:57 +0530)]
staging: rtl8188eu: hal: Drop Useless Initialization
Removed initialisation of a varible if it is immediately reassigned.
Changes were made using Coccinelle.
@bad@
identifier i;
position p;
@@
i =@p <+...i...+>;
@@
type T;
constant C;
expression e;
identifier i;
position p != bad.p;
@@
T i
- = C
;
i =@p e;
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Mon, 22 Feb 2016 17:08:03 +0000 (22:38 +0530)]
staging: rtl8188eu: Remove unnecessary parantheses
Removed parantheses on the right hand side of assignments as they are
not needed.
This was done with Coccinelle:
@@ expression a, b; @@
a =
- (
b
- )
;
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhumika Goyal [Fri, 11 Mar 2016 06:58:49 +0000 (12:28 +0530)]
Staging: sm750fb: Remove unused functions
The functions dviGetDeviceID and dviGetVendorID are not used anywhere in
the kernel so remove them. Also, remove their function prototypes.
Grepped to find occurences.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sandhya Bankar [Sun, 6 Mar 2016 09:37:44 +0000 (15:07 +0530)]
Staging: sm750fb: Remove leading and trailing whitespace.
Remove leading and trailing whitespace.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Eva Rachel Retuya [Sun, 6 Mar 2016 05:20:21 +0000 (13:20 +0800)]
staging: sm750fb: convert pr_err() to dev_err()
Replace pr_err() calls with respective dev_err() counterpart.
Change is safe since pdev is not NULL, this was identified by hand.
Semantic patch used to detect and apply the transformation:
@r exists@
identifier f,s,i;
position p;
@@
f(...,struct s *i,...) {
<+...
pr_err@p(...)
...+>
}
@s@
identifier r.s, dev;
@@
struct s {
...
struct device dev;
...
};
@t@
identifier r.i, s.dev;
expression fmt;
position r.p;
@@
- pr_err@p(
+ dev_err(&i->dev,
fmt, ...);
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Sun, 28 Feb 2016 15:57:49 +0000 (21:27 +0530)]
staging: sm750fb: Remove Unused macro
The macro PEEK32 is used nowhere in the file. Hence,removed.
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Sun, 28 Feb 2016 15:52:00 +0000 (21:22 +0530)]
staging: sm750fb: Use pcim_enable_device()
Devm_ functions allocate memory that is released when a driver
detaches.
Replace pci_enable_device with the managed pcim_enable_device
and remove corresponding pci_disable_device from probe and
suspend functions of a pci_dev.
Also, an unnecessary label has been removed by replacing it
with a direct return statement.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Sun, 28 Feb 2016 15:51:53 +0000 (21:21 +0530)]
staging: sm750fb: Replace kzalloc with devm_kzalloc
Devm_ functions allocate memory that is released when a driver
detaches.
Replace kzalloc with devm_kzalloc and remove corresponding
kfrees from probe and remove functions of a pci_dev.
Also, an unnecessary label has been removed by replacing it
with a direct return statement.
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 05:37:37 +0000 (11:07 +0530)]
staging: sm750fb: 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>
Amitoj Kaur Chawla [Wed, 24 Feb 2016 17:00:15 +0000 (22:30 +0530)]
staging: sm750fb: Remove parentheses from return arguments
Remove unnecessary parentheses from return arguments.
The Coccinelle semantic patch that makes this change is as follows:
// <smpl>
@@
identifier i;
constant c;
@@
return
- (
\(i\|-i\|i(...)\|c\)
- )
;
// </smpl>
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amitoj Kaur Chawla [Fri, 11 Mar 2016 18:41:47 +0000 (00:11 +0530)]
staging: most: hdm-usb: Remove invalid reference error
commit
e3479f77 ("staging: most: hdm-usb: Remove create_workqueue()")
cancel_work_sync(&anchor->clear_work_obj) is introduced after freeing
`anchor` causing a invalid reference error. This patch removes this
error by shifting the call to cancel_work_sync before freeing
`anchor`.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Sat, 5 Mar 2016 21:09:51 +0000 (02:39 +0530)]
staging: rts5208: 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 [Sun, 28 Feb 2016 20:28:44 +0000 (01:58 +0530)]
staging: rts5208: Remove NULL test before vfree
vfree frees the virtually continuous memory area starting at addr.
If addr is NULL, no operation is performed. So NULL test is not needed
before vfree.
This was done using Coccinelle:
@@
expression x;
@@
-if (x != NULL)
vfree(x);
@@
expression x;
@@
-if (x != NULL) {
vfree(x);
x = NULL;
-}
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Eva Rachel Retuya [Sat, 27 Feb 2016 12:39:24 +0000 (20:39 +0800)]
staging: rts5208: 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>
Bhumika Goyal [Fri, 26 Feb 2016 10:04:34 +0000 (15:34 +0530)]
Staging: rts5208: Use min instead of ternary operator
This patch replaces ternary operator with macro min as it shorter and
thus increases code readability. Macro min returns 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:42:24 +0000 (14:42 -0500)]
staging: rts5208: rtsx_transport.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>
Janani Ravichandran [Thu, 25 Feb 2016 19:37:56 +0000 (14:37 -0500)]
staging: rts5208: rtsx.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>
Amitoj Kaur Chawla [Thu, 25 Feb 2016 05:38:20 +0000 (11:08 +0530)]
staging: rts5208: 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>
Dilek Uzulmez [Tue, 23 Feb 2016 18:32:24 +0000 (20:32 +0200)]
Staging: rts5208: Remove unnecessary parentheses
Problem found using checkpatch.pl
CHECK: Unnecessary parentheses around chip->ms_card
Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Sun, 21 Feb 2016 09:53:37 +0000 (15:23 +0530)]
staging: rts5208: Prefer using BIT macro
Replace all instances of bit shifting on 1 with the BIT(x) macro.
This was done using Coccinelle.
@@ int c; @@
- (1 << c)
+ BIT(c)
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Sun, 21 Feb 2016 07:35:20 +0000 (13:05 +0530)]
staging: rts5208: Removed unnecessary return variable
This patch removes unnecessary return variables in switch statements.
This was done with Coccinelle:
@@ local idexpression ret; expression e1,e2; identifier label;
@@
switch ( ... ) {
case label : ...
- ret = e1;
- break;
+ return e1;
... default: ...
- ret = e2;
+ return e2;
... }
... when != ret
- 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>
Bhaktipriya Shridhar [Thu, 10 Mar 2016 17:36:23 +0000 (23:06 +0530)]
staging: media: davinci_vpfe: 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 [Thu, 10 Mar 2016 17:29:47 +0000 (22:59 +0530)]
staging: media: davinci_vpfe: dm365_ipipe_hw: 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>
Sandhya Bankar [Sun, 6 Mar 2016 13:24:09 +0000 (18:54 +0530)]
Staging: media: Remove unnecessary goto.
Remove unnecessary goto.
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:22 +0000 (20:39 +0800)]
staging: [media] mn88472: 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>
Amitoj Kaur Chawla [Thu, 25 Feb 2016 05:37:47 +0000 (11:07 +0530)]
staging: media: omap4iss: Remove unnecessary platform_set_drvdata()
Unnecessary platform_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 platform_device *pdev;
@@
- platform_set_drvdata(pdev, NULL);
//</smpl>
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhumika Goyal [Fri, 11 Mar 2016 10:23:57 +0000 (15:53 +0530)]
Staging: rtl8712: Remove function r8712_setptm_cmd and r8712_gettssi_cmd
The function r8712_setptm_cmd and r8712_gettssi_cmd are not used
anywhere in the kernel so remove them. Also, remove their function
prototypes.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhaktipriya Shridhar [Thu, 10 Mar 2016 16:50:25 +0000 (22:20 +0530)]
staging: rtl8712: 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>
Sandhya Bankar [Sun, 6 Mar 2016 10:03:31 +0000 (15:33 +0530)]
Staging: rtl8712: Avoid multiple assignments.
Avoid multiple assignments.This isssue is found by checkpatch.pl script.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
G Pooja Shamili [Sun, 6 Mar 2016 09:42:30 +0000 (15:12 +0530)]
staging: rtl8712: Remove the unnecessary parantheses
The unnecessary parantheses on the right side of assignments were removed,
as in most cases (expect for ==, >=, <=, !=), they are futile.
This was done using Coccinelle, the semantic patch being:
@@
expression E1,E2,E3;
binary operator bin_op = {==,>=,<=,!=};
@@
E1 =
(
(
E2 bin_op E3
)
|
-(
E2
-)
)
;
Signed-off-by: G Pooja Shamili <poojashamili@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>