staging: rtl8723au: Check kmalloc return value and fix size of memcpy()
Check kmalloc() return before dereferencing bssid in
rtw_check_bcn_info23a() and use the correct size to copy
rtw_basic_rate_ofdm in update_bmc_sta_support_rate23a()
Thomas Vegas [Sat, 26 Apr 2014 09:20:09 +0000 (11:20 +0200)]
staging: cxt1e1: Avoid using 0 instead of NULL
Fixed the following sparse warnings:
drivers/staging/cxt1e1/hwprobe.c:162:38:
warning: Using plain integer as NULL pointer
drivers/staging/cxt1e1/hwprobe.c:163:38:
warning: Using plain integer as NULL pointer
drivers/staging/cxt1e1/hwprobe.c:179:46:
warning: Using plain integer as NULL pointer
drivers/staging/cxt1e1/hwprobe.c:184:46:
warning: Using plain integer as NULL pointer
Signed-off-by: Thomas Vegas <thomas_75@safe-mail.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Merge tag 'iio-for-3.16a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
First round of IIO new driver, functionality and cleanups for the 3.16 cycle.
New device support
* AS3935 Lightning Sensor
* MCP3426/7/8 support added to the existing MCP3422 ADC driver
* AK8963 support in the AK8975 driver
* MPU6500 support in the MPU6050 driver (the functionality that is different
is mostly not supported yet in either part).
Staging Graduations
* AD799x ADC
New functionality
* ACPI enumeration for the ak8975 driver
Cleanup / tweaks
* Use snprintf as a matter of good practice in a few additional places.
* Document *_mean_raw attributes. These have been there a while, but were
undocumented.
* Add an in kernel interface to get the mean values.
* Bug in the length of the event info mask that by coincidence wasn't yet
actually causing any problems.
* itg3000 drop an unreachable return statement.
* spear_adc cleanups (heading for a staging graduation but a few more
issues showed up in the review of these patches).
* Exynos ADC dependencies changed so it is only built when Exynos is present
or COMPILE_TEST and OF are set.
* tsl2583 cleanups.
* Some cut and paste typos in the comments of various drivers still in staging.
* Couple of minor improvements to the ST sensor drivers.
iio: st_sensors: move regulator retrieveal to core
Currently the pressure sensor has code to retrieve and enable two
regulators for Vdd and Vdd IO, but actually these voltage inputs
are found on all of these ST sensors, so move the regulator
handling to the core and make sure all the ST sensors call these
functions on probe() and remove() to enable/disable power.
Here also mover over to obtaining the regulator from the *parent*
device of the IIO device, as the IIO device is created on-the-fly
in this very subsystem it very unlikely evert have any regulators
attached to it whatsoever. It is much more likely that the parent
is a platform device, possibly instantiated from a device tree,
which in turn have Vdd and Vdd IO supplied assigned to it.
Cc: Lee Jones <lee.jones@linaro.org> Cc: Denis CIOCCA <denis.ciocca@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
It is pretty helpful to know already from dmesg that a certain
device is successfully registered, instead of having to browse
sysfs to see if it's actually there.
Cc: Lee Jones <lee.jones@linaro.org> Cc: Denis CIOCCA <denis.ciocca@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Vitor Braga [Sun, 30 Mar 2014 03:44:59 +0000 (00:44 -0300)]
staging: xgifb coding style cleanup
This fixes "missing a blank line after declaration" warnings from
checkpatch.pl for driver xgifb. The driver has no remaining errors or
warnings from checkpatch.pl
Russell King [Fri, 18 Apr 2014 09:46:45 +0000 (10:46 +0100)]
imx-drm: fix hdmi hotplug detection initial state
The initial state at boot is assumed to be disconnected, and we hope
to receive an interrupt to update the status. Let's be more explicit
about the current state - reading the PHY status register tells us
the current level of the hotplug signal, which we can report back in
the _detect() method.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The decoder mux id is equal to the port id of the encoder's input port
that is connected to the given crtc, not to the endpoint id (which is
arbitrary and usually zero).
staging: imx-drm: imx-hdmi: clean up hdmi_phy_wait_i2c_done
Simplify hdmi_phy_wait_i2c_done so the call to hdmi_readb is
only done in one place. Also check for timout before waiting
as suggested by Troy Kisky.
This also fixes a checkpatch warning.
Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The driver can already use request_firmware() to load firmware, and
always does so. There is code in init_firmware() to use the static
firmware images, but it's unreachable! Remove the data and simplify
init_firmware() accordingly.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8188eu: Simplify led blinking strategy code.
driver has code to blink the led in 7 different ways.
struct led_priv contains an enum LED_STRATEGY_871x variable which is
initialized to SW_LED_MODE1 inside rtl8188eu_InitSwLeds() function.
it means driver is hard coded to use only SW_LED_MODE1 blinking strategy.
so we can remove the code related to other blinking strategies
e.g. SW_LED_MODE[0|2|3|4|5|6].
_ReadLEDSetting() doesn't read led settings this function actually
initialize member variables of struct led_priv, we should do that
inside rtl8188eu_InitSwLeds().
staging: rtl8188eu: fix spaces instead of tabs for rtw_p2p.c
This commit fixes the following checkpatch errors:
rtl8188eu/core/rtw_p2p.c
- 1508: ERROR: code indent should use tabs where possible
- 1509: ERROR: code indent should use tabs where possible
- 1510: ERROR: code indent should use tabs where possible
Signed-off-by: Konrad Zapalowicz <bergo.torino@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mark Einon [Sat, 19 Apr 2014 14:35:49 +0000 (15:35 +0100)]
staging: rtl8821ae: Fix indetentation of switch case statements
Fixes checkpatch error:
ERROR: switch and case should be at the same indent
+ switch (coex_dm->cur_retrylimit_type) {
+ case 0: /* normal mode */
[...]
+ case 1: /* retry limit=8 */
[...]
+ default:
Signed-off-by: Mark Einon <mark@einon.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mark Einon [Sat, 19 Apr 2014 14:35:45 +0000 (15:35 +0100)]
staging: rtl8821ae: Fix halbtc8192e2ant.c 'defined but not used' sparse warnings
Sparse complains about halbtc8192e2ant_low_penalty_ra() not being used,
and subsequently halbtc8192e2ant_set_sw_penalty_tx_rateadaptive() when
this is removed. remove both functions.
Signed-off-by: Mark Einon <mark@einon.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The symbol 'r8192_get_wireless_stats' is declared as 'extern'
but it is only used in the local scope. The declaration is deleted
of rtl_wx.h, fixing the conflict with the 'extern' and 'static' scope.
The symbol 'r8192_wx_handlers_def' was fixed of some issues related
to variable declaration marked as 'extern' implicitly,
causing this sparse warning:
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c:1323:24: warning: symbol
'r8192_wx_handlers_def' was not declared. Should it be static?
Resolved incluing the fixed header to rtl_wx.c
Also, isn't declared as constant variable, so it declared as such.
And delete unnecessary cast in rtl_core.c.
Signed-off-by: Joel Pelaez Jorge <joelpelaez@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Mon, 7 Apr 2014 06:31:21 +0000 (09:31 +0300)]
Staging: rtl8188eu: overflow in update_sta_support_rate()
The ->SupportedRates[] array has NDIS_802_11_LENGTH_RATES_EX (16)
elements. Since "ie_len" comes from then network and can go up to 255
then it means we should add a range check to prevent memory corruption.
Fixes: d6846af679e0 ('staging: r8188eu: Add files for new driver - part 7') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Some code is hide inside #ifdef BP_PROC_SUPPORT and it never defined
anywhere. And, it made defined but not used function which calling
code was hide inside #ifdef BP_PROC_SUPPORT and caused following
build warning:
drivers/staging/silicom/bpctl_mod.c:6786:12: warning:
‘bp_proc_create’ defined but not used [-Wunused-function]
static int bp_proc_create(void)
^
Fix the warning and remove code complexity by remove whole code
inside #ifdef BP_PROC_SUPPORT.
Signed-off-by: SeongJae Park <sj38.park@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Staging: lustre: ops structs should be declared static
Fixed the following sparse complaints:
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:549:22:
warning: symbol 'ldlm_srv_pool_ops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:555:22:
warning: symbol 'ldlm_cli_pool_ops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:681:1:
warning: symbol 'lprocfs_pool_state_fops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:697:1:
warning: symbol 'lprocfs_grant_plan_fops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:700:1:
warning: symbol 'lprocfs_wr_recalc_period' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:708:1:
warning: symbol 'lprocfs_recalc_period_fops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:710:1:
warning: symbol 'ldlm_pool_u64_fops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:711:1:
warning: symbol 'ldlm_pool_atomic_fops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:712:1:
warning: symbol 'ldlm_pool_rw_atomic_fops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:714:1:
warning: symbol 'lprocfs_grant_speed_fops' was not declared. Should it be static?
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:755:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:757:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:758:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:759:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:760:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:762:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:764:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:765:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:766:9:
warning: Using plain integer as NULL pointer
drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:768:9:
warning: Using plain integer as NULL pointer
Dan Carpenter [Thu, 24 Apr 2014 21:49:13 +0000 (00:49 +0300)]
staging: lustre: improve length checks in ioctls
We copy "hdr->ioc_len" from the user twice but we only verify that it's
within the limit on the first copy. Otherwise we could read unmapped
memory and Oops.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Peng Tao <bergwolf@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This helper function is called by the ai (*do_cmd) to setup and
start the async command based on the "mode" of operation. This
"mode" is determined by the cmd convert_src and start_src.
Move this "mode" determination and combine the functions.
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>
staging: comedi: adv_pci1710: remove 'ai_timer1' from private data
This member of the private data is just a copy of the cmd->convert_arg.
Use that instead and remove the unnecessary sanity checking since it
was already validated in the (*do_cmdtest).
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>
staging: comedi: addi_apci_1564: separate from addi_common.c
Using the addi-data "common" code in addi_apci_1564 introduces a lot of
bloat. By separating this driver off from addi_common.c, a lot of the
common code can be stripped out. This patch copies the code over from
addi_common.c, and removes the #include of the file. The auto_attach
function from the common code replaces the one that was previously in this
driver, though renamed to that it stays within the namespace associated
with this driver, and the detach function has been renamed for this reason
as well.
Signed-off-by: Chase Southwood <chase.southwood@yahoo.com> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: amplc_pci224: only calc the pacer divisors once
When the cmd->scan_begin_src == TRIG_TIMER the divisors needed to
generate the pacer time are calculated in the (*do_cmdtest) to
validate the cmd->scan_begin_arg. The core always does the
(*do_cmdtest) before the (*do_cmd) so there is no reason to recalc
the divisors.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: cb_pcidas64: remove unnecessary Step 2b test in (*do_cmdtest)
This test is unnecessary. The cfc_check_trigger_src() in Step 1 ensures that
the trigger source is one of these values and Step 2 makes sure it's only one
of these values.
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>
Monam Agarwal [Sun, 23 Mar 2014 18:38:22 +0000 (00:08 +0530)]
drivers/staging: Use RCU_INIT_POINTER(x, NULL) in fwserial/fwserial.c
This patch replaces rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL)
The rcu_assign_pointer() ensures that the initialization of a structure
is carried out before storing a pointer to that structure.
And in the case of the NULL pointer, there is no structure to initialize.
So, rcu_assign_pointer(p, NULL) can be safely converted to RCU_INIT_POINTER(p, NULL)
fwserial: (coding style) removing FSF postal address
Style-only modifications to make checkpatch.pl --file --strict a bit happier.
Removing FSF postal address from file top comment since it has changed in the
past, as stated by checkpatch.pl.
Signed-off-by: Dominique van den Broeck <domdevlin@free.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Style-only modifications to make checkpatch.pl --file --strict a bit happier.
Removed useless "extern" in dma_fifo.h ;
Removed one supernumerary space.
Signed-off-by: Dominique van den Broeck <domdevlin@free.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Style-only modifications to make checkpatch.pl --file --strict a bit happier.
if/else bracket matching (either none or both options should be bracketed).
Signed-off-by: Dominique van den Broeck <domdevlin@free.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: usbduxfast: fix the cmd->start_arg validation and use
This driver supports cmd->start_src values of TRIG_NOW, TRIG_EXT, and
TRIG_INT. Currently the cmd->start_arg is only validated for TRIG_NOW.
For TRIG_EXT sources, the cmd->start_src is driver specific. For a
TRIG_INT source, the cmd->start_arg is actually the valid trig_num
that is used by the async (*inttrig) callback.
The cmd->start_arg is currently not use in the driver. Just trivially
validate it to be 0 for all cmd->start_src values.
Refactor the (*inttrig) function so that the cmd->start_arg is used
to check the trig_num instead of the open coded value.
For aesthetics, remove some unnecessary comments in the (*do_cmd)
function.
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>
staging: comedi: usbduxsigma: fix the ai/ao cmd->start_arg use for TRIG_INT
For both ai and ao commands this driver supports a cmd->start_src of
TRIG_NOW or TRIG_INT. The cmd->start_arg is trivially validated for
both sources to be 0.
For a TRIG_INT source, the cmd->start_arg is actually the valid
trig_num that is used by the async (*inttrig) callback.
Refactor the (*inttrig) functions so that the cmd->start_arg is used
to check the trig_num instead of the open coded values.
For aesthetics, remove some unnecessary comments in the (*do_cmd)
functions.
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>