Andy Shevchenko [Fri, 13 Sep 2013 06:44:31 +0000 (09:44 +0300)]
staging: silicom: introduce bp_dev_get_idx_bsf() and use it
There are two places where duplicate code is located. Moreover, there is a
custom implementation of the sscanf() functionality. This patch makes code
quite simplier and cleaner.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: speakup: kobjects.c: Use correct values when changing voice.
When a new voice is selected, we set volume and pitch appropriate for
the voice. We need to use the numeric index corresponding to the
voice when indexing into the volume and pitch tables, rather than
the raw user input that was used to select the voice.
Note that using the raw input can also lead to an invalid memory read
in the case of invalid or malicious user input.
Signed-off-by: Christopher Brannon <chris@the-brannons.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Well, there is no need to use strcmp since we can make a test of similar semantic by using the var_id field of param.
I moved the test into the VAR_NUM:VAR_TIME case since VAR_STRING will never be "voice".
spk_xlate isn't used anymore (in line 628), then there is no difference between using cp and buf in VAR_STRING case.
Besides, buf is a const char and those changes remove one uneeded line.
I created the function spk_reset_default_value because it clarifies the code and allows code reusing.
This code uses a while construction that has an unconditional break. This part
of the code was restructured to use an if statement and the dead code was
removed.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Larry Finger [Wed, 4 Sep 2013 20:56:10 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warnings in core/rtw_recv.c
Smatch reports the following:
drivers/staging/rtl8188eu/core/rtw_recv.c:211 rtw_free_recvframe() warn: variable dereferenced before check 'precvframe' (see line 207)
drivers/staging/rtl8188eu/core/rtw_recv.c:1803 amsdu_to_msdu() warn: variable dereferenced before check 'sub_skb' (see line 1784)
The code was rearranged to eliminate the dereference before the check.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Larry Finger [Wed, 4 Sep 2013 20:56:09 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warning in hal/HalPhyRf_8188e.c
Smatch reported the following warning:
drivers/staging/rtl8188eu/hal/HalPhyRf_8188e.c:1876 PHY_APCalibrate_8188E() info: ignoring unreachable code.
Once the unreachable code was removed, the entire routine was removed, which
led to the warning that phy_APCalibrate_8188E() was not used. It was also deleted
along with some unused defines.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Larry Finger [Wed, 4 Sep 2013 20:56:08 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warning in core/rtw_wlan_util.c
A misplaced _func_exit_ macro leads to the following smatch warning:
drivers/staging/rtl8188eu/core/rtw_wlan_util.c:1105 rtw_check_bcn_info() info: ignoring unreachable code.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Larry Finger [Wed, 4 Sep 2013 20:56:01 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warning in hal/usb_ops_linux.c
Smatch reports the following warning:
drivers/staging/rtl8188eu/hal/usb_ops_linux.c:614 usb_read_port() warn: variable dereferenced before check 'precvbuf' (see line 611)
Fixing this particular warning required some refactoring of the code.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Larry Finger [Wed, 4 Sep 2013 20:56:00 +0000 (15:56 -0500)]
staging: r8188eu: Fix smatch warning in os_dep/osdep_service.c
Smatch reports the following warning:
drivers/staging/rtl8188eu/os_dep/osdep_service.c:634 rtw_change_ifname() warn: variable dereferenced before check 'padapter' (see line 630)
The dereference in question is deferred until the validity of 'padapter' is verified.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Larry Finger [Wed, 4 Sep 2013 20:55:59 +0000 (15:55 -0500)]
staging: r8188eu: Fix a smatch warnings in core/rtw_recv.c
Smatch reports the following:
drivers/staging/rtl8188eu/os_dep/recv_linux.c:227 rtw_recv_indicatepkt() warn: variable dereferenced before check 'precv_frame' (see line 139)
The test in this location is removed and added in the free routine.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Larry Finger [Wed, 4 Sep 2013 20:55:54 +0000 (15:55 -0500)]
staging: r8188eu: Fix smatch error in core/rtw_mlme_ext.c
Smatch reports the following warning:
"drivers/staging/rtl8188eu/core/rtw_mlme_ext.c:8328 mlme_evt_hdl()
error: buffer overflow 'wlanevents' 24 <= 24"
8321 /* checking if event code is valid */
8322 if (evt_code >= MAX_C2HEVT) {
^^^^^^^^^^^^^^^^^^^^^^
8323 RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nEvent Code(%d) mismatch!\n", evt_code));
8324 goto _abort_event_;
8325 }
8326
8327 /* checking if event size match the event parm size */
8328 if ((wlanevents[evt_code].parmsize != 0) &&
^^^^^^^^^^^^^^^^^^^^
8329 (wlanevents[evt_code].parmsize != evt_sz)) {
8330 RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_,
8331 ("\nEvent(%d) Parm Size mismatch (%d vs %d)!\n",
8332 evt_code, wlanevents[evt_code].parmsize, evt_sz));
8333 goto _abort_event_;
8334 }
This warning results because the number of items in "enum rtw_c2h_event",
which determines the value of MAX_C2HEVT, is one more than in "struct wlanevents".
Adding an extra dummy event to the latter fixes the problem.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Larry Finger [Wed, 4 Sep 2013 20:55:53 +0000 (15:55 -0500)]
staging: r8188eu: Fix Smatch off-by-one warning in hal/rtl8188e_hal_init.c
Smatch reports the following warning:
"drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c:2008
Hal_ReadPowerValueFromPROM_8188E()
error: buffer overflow 'pwrInfo24G->IndexBW40_Base[rfPath]' 5 <= 5"
drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
2005 /* 2.4G default value */
2006 for (group = 0; group < MAX_CHNL_GROUP_24G; group++) {
2007 pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
2008 pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX;
The reason is that IndexCCK_Base[] has MAX_CHNL_GROUP_24G elements, but
IndexBW40_Base is smaller by 1. Make them both have MAX_CHNL_GROUP_24G
elements.
Reported by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jon Bernard [Tue, 10 Sep 2013 22:00:01 +0000 (18:00 -0400)]
Staging: fwserial: wrap a line that exceeds 80 characters
This is a patch to fwserial.c that wraps a line which previously exceeded the 80
character limit warning found by checkpatch.pl. This driver is now warning and
error free, according to checkpatch.pl
Signed-off-by: Jon Bernard <jbernard@tuxion.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixed space prohibition before semicolon, particularly:
nvm.c:106: WARNING: space prohibited before semicolon
nvm.c:1098: WARNING: space prohibited before semicolon
nvm.c:1279: WARNING: space prohibited before semicolon
nvm.c:2834: WARNING: space prohibited before semicolon
nvm.c:3361: WARNING: space prohibited before semicolon
nvm.c:4453: WARNING: space prohibited before semicolon
Fixed a few of the coding style issues reported by checkpatch.pl
Signed-off-by: Faris de Haan <farisdehaan@gmail.com> Acked-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jingoo Han [Mon, 9 Sep 2013 05:17:32 +0000 (14:17 +0900)]
staging: dgrp: Remove casting the return value which is a void pointer
Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.
Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixed some of the coding style issues reported by checkpatch.pl
Signed-off-by: Faris de Haan <farisdehaan@gmail.com> Acked-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jingoo Han [Mon, 9 Sep 2013 05:19:48 +0000 (14:19 +0900)]
staging: dgap: Remove casting the return value which is a void pointer
Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.
Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: s626: use comedi_dio_update_state()
The extra mask used to only update the channels configured as outputs is
not necessary in this driver. Remove it and use comedi_dio_update_state()
to handle the boilerplate code to update the subdevice s->state.
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: me_daq: use comedi_dio_update_state()
The extra mask used to only update the channels configured as outputs is
not necessary in this driver. Remove it and use comedi_dio_update_state()
to handle the boilerplate code to update the subdevice s->state.
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: me4000: use comedi_dio_update_state()
The extra mask used to only update the channels configured as outputs is
not necessary in this driver. Remove it and use comedi_dio_update_state()
to handle the boilerplate code to update the subdevice s->state.
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: ii_pci20kc: use comedi_dio_update_state()
The extra mask used to only update the channels configured as outputs is
not necessary in this driver. Remove it and use comedi_dio_update_state()
to handle the boilerplate code to update the subdevice s->state.
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_3xxx: use comedi_dio_update_state()
The extra mask used to only update the channels configured as outputs is
not necessary in this driver. Remove it and use comedi_dio_update_state()
to handle the boilerplate code to update the subdevice s->state.
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_16xx: use comedi_dio_update_state()
The extra mask used to only update the channels configured as outputs is
not necessary in this driver. Remove it and use comedi_dio_update_state()
to handle the boilerplate code to update the subdevice s->state.
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: drivers: use comedi_dio_update_state() for complex cases
Use comedi_dio_update_state() to handle the boilerplate code to update
the subdevice s->state for more complex cases where the hardware is only
updated based on the 'mask' of the channels that are modified.
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: drivers: use comedi_dio_update_state() for simple cases
Use comedi_dio_update_state() to handle the boilerplate code to update
the subdevice s->state for simple cases where the hardware is updated
when any channel is modified.
Also, fix a bug in the amplc_pc263 and amplc_pci263 drivers where the
current state is not returned in data[1].
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>
The (*insn_bits) functions for DIO and DO subdevices typically use
the subdevice 's->state' to hold the current state of the output
channels. The 'insn' passed to these functions, INSN_BITS, specifies
two parameters passed in the 'data'.
data[0] = 'mask', the channels to update
data[1] = 'bits', the new state for the channels
Introduce a helper function to handle the boilerplate used to
update the internal state.
Note that the 'mask' is filtered by the 'chanmask' of the channels
actually supported by the subdevice. This is used to protect any
non-channel related bits that are stored in the subdevice state.
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: initialize subdevice s->io_bits in postconfig
The subdevice 'io_bits' is a bit mask of the i/o configuration for
digital subdevices. '0' values indicate that a channel is configured
as an input and '1' values that the channel is an output. Since the
subdevice data is kzalloc()'d, all channels default as inputs.
Modify __comedi_device_postconfig() so that 'io_bits' is correctly
initialized for Digital Output subdevices.
Remove all the unnecessary initializations of 's->io_bits' from the
drivers. Also, remove the unnecessary initialization of the 's->state'.
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>
Sean Williams [Sat, 7 Sep 2013 22:51:34 +0000 (15:51 -0700)]
Staging: comedi: ni_at_a2150: Remove a few superfluous braces
Please don't flame me :) I'm getting my feet wet with kernel contribution.
One example I saw in a video by GKH suggested cleaning up coding style as a good first commit.
Signed-off-by: Sean Williams <unixed@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging/android: Add kerneldoc to one function in alarm-dev.c
Sorry. I thought that this would be a nice easy class to document fully.
Turns out I was very wrong - I will have to research the Linux alarm and
timer subsystem one day next week and try again.
Here is what I started out with, anyway. It's not much, but it's better
than nothing!
staging/android: Initial partial kernel-doc for ashmem.c
I am beginning to understand the core concepts at play here.
I am nowhere near finished with this class - However, it is better if
I commit what I have documented so far tonight - That way, if I mess
up tomorrow morning, I can just roll back to here.
Sorry if this clutters things up. In the end, once *everything* is
documented, it will make understanding the Android staging driver
easier to understand as a programmer - Hopefully for both new developers
and current ones.
Chen Gang [Mon, 2 Sep 2013 09:11:57 +0000 (17:11 +0800)]
drivers: staging: android: Kconfig: add depends on MMU for ANDROID_BINDER_IPC
ANDROID_BINDER_IPC used the functions which need depend on MMU, so need
let it depend on MMU too, or compiling fails.
The related error:
drivers/built-in.o: In function `binder_update_page_range':
drivers/staging/android/binder.c:599: undefined reference to `map_vm_area'
drivers/staging/android/binder.c:626: undefined reference to `zap_page_range'
drivers/built-in.o: In function `binder_mmap':
drivers/staging/android/binder.c:2744: undefined reference to `get_vm_area'
Signed-off-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bojan Prtvar [Mon, 2 Sep 2013 06:18:40 +0000 (08:18 +0200)]
Staging: android: Mark local functions in binder.c as static
This fixes the following sparse warnings
drivers/staging/android/binder.c:1703:5: warning: symbol 'binder_thread_write' was not declared. Should it be static?
drivers/staging/android/binder.c:2058:6: warning: symbol 'binder_stat_br' was not declared. Should it be static?
Signed-off-by: Bojan Prtvar <prtvar.b@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bojan Prtvar [Sun, 1 Sep 2013 18:30:38 +0000 (20:30 +0200)]
Staging: android: add __user annotation in binder.c
This fixes the following sparse error
drivers/staging/android/binder.c:1795:36: error: incompatible types in comparison expression (different address spaces)
Signed-off-by: Bojan Prtvar <prtvar.b@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Merge branch 'timers/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer code update from Thomas Gleixner:
- armada SoC clocksource overhaul with a trivial merge conflict
- Minor improvements to various SoC clocksource drivers
* 'timers/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
clocksource: armada-370-xp: Add detailed clock requirements in devicetree binding
clocksource: armada-370-xp: Get reference fixed-clock by name
clocksource: armada-370-xp: Replace WARN_ON with BUG_ON
clocksource: armada-370-xp: Fix device-tree binding
clocksource: armada-370-xp: Introduce new compatibles
clocksource: armada-370-xp: Use CLOCKSOURCE_OF_DECLARE
clocksource: armada-370-xp: Simplify TIMER_CTRL register access
clocksource: armada-370-xp: Use BIT()
ARM: timer-sp: Set dynamic irq affinity
ARM: nomadik: add dynamic irq flag to the timer
clocksource: sh_cmt: 32-bit control register support
clocksource: em_sti: Convert to devm_* managed helpers
Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6
Pull CIFS fixes from Steve French:
"Two minor cifs fixes and a minor documentation cleanup for cifs.txt"
* 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
cifs: update cifs.txt and remove some outdated infos
cifs: Avoid calling unlock_page() twice in cifs_readpage() when using fscache
cifs: Do not take a reference to the page in cifs_readpage_worker()