staging: rtl8192u: r8192U_core: fix use ether_addr_copy() over memcpy() code style issue
Prefer ether_addr_copy() over memcpy() if the Ethernet addresses
are __aligned(2)
The values used are stored as dev_addr in net_device (declared in
include/linux/netdevice.h) and sa_data in sockaddr (declared in
include/linux/socket.h). Both these elements are u16 aligned as
shown by using pahole (position must be a multiple of sizeof(u16)):
unsigned char * dev_addr; /* 888 8 */
char sa_data[14]; /* 2 14 */
It is thus safe to use ether_addr_copy() instead of memcpy() for
that call, as it is already done in multiple files in the Linux
kernel sources:
drivers/net/ethernet/broadcom/genet/bcmgenet.c
drivers/net/ethernet/brocade/bna/bnad.c
drivers/net/ethernet/emulex/benet/be_main.c
drivers/net/ethernet/ezchip/nps_enet.c
drivers/net/ethernet/ibm/ibmveth.c
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/usb/lan78xx.c
net/8021q/vlan_dev.c
net/batman-adv/soft-interface.c
net/dsa/slave.c
Using strcpy() is a security risk as the destination buffer size is not
checked and we may over-run the buffer. Use strncpy() instead, while
mentioning the buffer size leaving place for the NULL termination.
If lov_sub_get() fails then it returns the error code in ERR_PTR, but
here we were dereferencing sub without checking if lov_sub_get() has
actually succeeded or not. And on error we can directly return the error
code from lov_io_fault_start() as it return 0 on success and the error
code on error.
Staging: lustre: obdclass: Remove typedefs for struct
The Linux kernel coding style guidelines suggest not using typedefs for
structure and enum types. This patch gets rid of the typedefs for
lu_site_stats_t.
The following Coccinelle semantic patch detects the cases for struct type:
Staging: lustre: libcfs: Remove typedefs for struct
The Linux kernel coding style guidelines suggest not using typedefs for
structure and enum types. This patch gets rid of the typedefs for
cfs_wi_sched_t.
The following Coccinelle semantic patch detects the cases for struct type:
Tony Cho [Tue, 8 Sep 2015 08:08:01 +0000 (17:08 +0900)]
staging: wilc1000: add maintainers for Atmel 802.11 driver
This patch adds new maintainers who develops new design for Atmel 802.11
link controller and deletes Dean Lee who cannot maintain the wireless
driver anymore.
Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Johnny Kim [Tue, 8 Sep 2015 08:08:00 +0000 (17:08 +0900)]
staging: wilc1000: remove meaningless line
The current driver is calling skb_reserve function to align memory in
frmw_to_linux function. However, the wrong value is used as the input argument.
Besides, the process is not necessary because the address already is algined
in dev_alloc_skb function. So, this patch removes the line for dummy headroom.
Signed-off-by: Johnny Kim <johnny.kim@atmel.com> Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch adds new define, IDLE_MODE to change comparison statement which
is wrong due to typecasting to null.
Signed-off-by: Johnny Kim <johnny.kim@atmel.com> Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tony Cho [Mon, 7 Sep 2015 10:09:31 +0000 (19:09 +0900)]
staging: wilc1000: fix potential memory leak
This patch adds kfree(mgmt_tx) when memory allocation of mgmt_tx->buff
fails in the second calls of kmalloc() to avoid the memory leak from mgmt_tx
first allocated before the second calls of kmalloc().
Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Chris Park <chirs.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: wilc1000: remove wrapper around usleep_range()
Just call the function directly, no need for the indirection.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
If memdup_user() fails then it will return the error code in ERR_PTR. We
were checking it with IS_ERR but then again trying to free it on the
error path.
Johnny Kim [Thu, 20 Aug 2015 07:32:52 +0000 (16:32 +0900)]
staging: wilc1000: use id value as argument
The driver communicates with the chipset via the address of handlers
to distinguish async data frame. The SendConfigPkt function gets the
pointer address indicating the handlers as the last argument, but this
requires redundant typecasting and does not support the 64 bit machine.
This patch adds the function which assigns ID values instead of pointer
representing the driver handler to the address and then uses the ID
instead of pointer as the last argument of SendConfigPkt. The driver
also gets the handler's address from the ID in the data frame when it
receives them.
Signed-off-by: Johnny Kim <johnny.kim@atmel.com> Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Just call the spinlock functions directly, no need for the indirection.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: wilc1000: remove wrappers around semaphore usage
Just call up/down directly, no need for a wrapper function that hides
what is really happening. Fix up some variable types to be the correct
structure pointers, not void *.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: wilc1000: remove wrappers around sema_init()
Just call the function directly. Also remove a pointless "deinit"
function that was empty to match the init function.
This also fixes a bug where txq_add_to_head_cs was a mutex structure
being used as a semaphore. See the fun things that happen when you use
void pointers instead of "real" types? Amazing that this worked at all,
someone got _very_ lucky. Whoever "Amr" is, they really didn't fix
BugID_4720 correctly :(
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: wilc1000: remove wrapper around spin_lock_init()
It's only called once, so just call the real function. Also remove the
empty "deinit" function that didn't do anything.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Just call the functions directly. Also fix the variable types to be
correct, not void *, so we have a semblance of type safety happening
now.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Just call the function, no need for a pointer to a function that calls
the function.
turtles, all the way down...
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
It isn't needed, and we were checking if a buffer was not NULL multiple
times, no one had ever looked at the code :(
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: wilc1000: remove another useless kmalloc wrapper
A static function that just calls kmalloc(), and only used in one place.
It's obvious that the wrappers on wrappers in this driver have never
actually been reviewed...
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: wilc1000: remove another pointless kmalloc wrapper
Call kmalloc directly, don't make a special "atomic" function pointer to
call it instead.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
just call kmalloc directly, don't use an indirect pointer to a wrapper
function.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The config option, CONFIG_WILC1000_PREALLOCATE_DURING_SYSTEM_BOOT, was
never able to be set, so this file was never being built. Also, as
WILC_PREALLOC_AT_BOOT was never being set in the build system, remove
all code framed by that symbol.
Cc: Johnny Kim <johnny.kim@atmel.com> Cc: Rachel Kim <rachel.kim@atmel.com> Cc: Dean Lee <dean.lee@atmel.com> Cc: Chris Park <chris.park@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: mt29f_spinand: Export OF module alias information
The SPI core always reports the MODALIAS uevent as "spi:<modalias>"
regardless of the mechanism that was used to register the device
(i.e: OF or board code) and the table that is used later to match
the driver with the device (i.e: SPI id table or OF match table).
So drivers needs to export the SPI id table and this be built into
the module or udev won't have the necessary information to autoload
the needed driver module when the device is added.
But this means that OF-only drivers needs to have both OF and SPI id
tables that have to be kept in sync and also the dev node compatible
manufacturer prefix is stripped when reporting the MODALIAS. Which can
lead to issues if two vendors use the same SPI device name for example.
To avoid the above, the SPI core behavior may be changed in the future
to not require an SPI device table for OF-only drivers and report the
OF module alias. So, it's better to also export the OF table even when
is unused now to prevent breaking module loading when the core changes.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fbtft_par_dbg(DEBUG_SET_ADDR_WIN.. ) is repeated in every
set_addr_win() handler, this could be replicated by using the kernel
function tracer instead.
Mike Rapoport [Thu, 3 Sep 2015 05:13:10 +0000 (08:13 +0300)]
staging: fbtft: remove unused bl_ops from fbtft_unregister_backlight
The only usage of bl_ops variable in fbtft_unregister_backlight function
was assigment of a value to that variable, therefore the assignment and
the variable itself can be safely removed
Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Quoted strings should not be split to help text grep in the source.
All quoted strings that were split have thus been merged to one unique
quoted string each to follow the code style.