Marcus Farkas [Sat, 17 May 2014 17:38:29 +0000 (19:38 +0200)]
staging: rtl8712: fix missing blank lines after declarations
This commit fixes the following checkpatch warnings:
rtl8712/rtl871x_security.c
- 275: WARNING: Missing a blank line after declarations
- 768: WARNING: Missing a blank line after declarations
- 801: WARNING: Missing a blank line after declarations
Signed-off-by: Marcus Farkas <marcus.farkas@finitebox.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8712: fix potential leaks in r8712_set_key()
Fix potential leaks in the error paths of r8712_set_key(). In case the
algorithm specific checks fail, the function returns without enqueuing
or freeing the already allocated command and parameter structs. Use a
centralized exit path and make sure that all memory is freed correctly.
Detected by Coverity - CID 144370, 144371.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8712: fix potential leak in r871x_wx_set_enc_ext()
Fix a potential leak in the error path of r871x_wx_set_enc_ext(). In case the
requested algorithm is not supported by the driver, the function returns
without freeing the already allocated 'param' struct. Move the input
verification to the beginning of the function so that the direct return is
safe. Detected by Coverity - CID 144373.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch remove variables that are initialized with a constant,
are never updated, and are only used as parameter of return.
Return the constant instead of using a variable.
Verified by compilation only.
The coccinelle script that find and fixes this issue is:
// <smpl>
@@
type T;
constant C;
identifier ret;
@@
- T ret = C;
... when != ret
- return ret;
+ return C;
// </smpl>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John Church [Wed, 7 May 2014 12:30:02 +0000 (13:30 +0100)]
staging : android: Fixes a coding style issue in timed_gpio.c
This patch fixes a coding style issue for a line that was over 80 characters long.
Signed-off-by: John Church <sleeveroller@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8188eu: remove dead code in rtw_drv_init()
(status != _SUCCESS) immediately after 'status = _SUCCESS' will never evaluate
true. Thus remove the logically dead code. Detected by Coverity - CID 1077553.
staging: rtl8188eu: fix usage of uninit scalar in rtw_drv_init()
Function rtw_drv_init() is written in a way that assumes 'status' != _SUCCESS
as long as not explicitly set. Thus initialize 'status' to FAIL, in order to
prevent undefined behaviour if going through the exit paths. Detected by
Coverity - CID 1077832.
staging: rtl8188eu: fix potential leak in rtw_set_key()
Fix a potential leak in the error path of rtw_set_key(). In case the requested
algorithm is not supported by the driver, the function returns without
enqueuing or freeing the already allocated command and parameter structs. Use
a centralized exit path and make sure that all memory is freed correctly.
Detected by Coverity - CID 1077716, 1077717.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8188eu: fix potential leak in update_bcn_wps_ie()
Fix a potential leak in the error path of function update_bcn_wps_ie().
Move the affected input verification to the beginning of the function so
that it may return directly without leaking already allocated memory.
Detected by Coverity - CID 1077718.
staging: rtl8188eu: fix potential leak in rtw_mp_pwrtrk()
Function rtw_mp_pwrtrk() dynamically allocates a temporary buffer that
is not freed in all error paths. Use a centralized exit path and make sure
that all memory is freed correctly. Detected by Coverity - 1077715.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8188eu: fix potential leak in rtw_mp_SetRFPath()
Function rtw_mp_SetRFPath() dynamically allocates a temporary buffer that
is not freed in all error paths. Use a centralized exit path and make sure
that all memory is freed correctly. Detected by Coverity - CID 1077714.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8188eu: fix potential leak in rtw_mp_QueryDrv()
Function rtw_mp_QueryDrv() dynamically allocates a temporary buffer that
is not freed in all error paths. Use a centralized exit path and make sure
that all memory is freed correctly. Detected by Coverity - CID 1077713.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8188eu: fix potential leak in rtw_wx_set_enc_ext()
Function rtw_wx_set_enc_ext() dynamically allocates a temporary buffer that
is not freed in all error paths. Use a centralized exit path and make sure
that all memory is freed correctly. Detected by Coverity - CID 1077712.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8188eu: fix potential leak in rtw_wx_read32()
Function rtw_wx_read32() dynamically allocates a temporary buffer that is not
freed in all error paths. Use a centralized exit path and make sure that all
memory is freed correctly. Detected by Coverity - CID 1077711.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix sparse warnings by adding __user and __iomem annotations where
necessary and removing certain unnecessary casts. While at it,
also use u32 in place of __u32.
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch remove variables that are initialized with a constant,
are never updated, and are only used as parameter of return.
Return the constant instead of using a variable.
Verified by compilation only.
The coccinelle script that find and fixes this issue is:
// <smpl>
@@
type T;
constant C;
identifier ret;
@@
- T ret = C;
... when != ret
- return ret;
+ return C;
// </smpl>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8821ae: fix not declared symbols should be static in sw.c
This commit fixes the following sparse warnings:
drivers/staging/rtl8821ae/rtl8821ae/sw.c:
- 48:6: warning: symbol 'rtl8821ae_init_aspm_vars' was not declared.
Should it be static?
- 228:5: warning: symbol 'rtl8812ae_rx_command_packet_handler' was
not declared. Should it be static?
- 263:20: warning: symbol 'rtl8821ae_hal_ops' was not declared.
Should it be static?
- 314:23: warning: symbol 'rtl8821ae_mod_params' was not declared.
Should it be static?
- 321:20: warning: symbol 'rtl8821ae_hal_cfg' was not declared.
Should it be static?
All of this symbols are local, that is there are no references to them
in the other files from this driver.
Signed-off-by: Konrad Zapalowicz <bergo.torino@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tair Rzayev [Sun, 4 May 2014 08:44:52 +0000 (11:44 +0300)]
staging: keucr: smilmain.c: cosmetic updates
* Move Check_D_MediaFmt() implementation up in smilmain.c to keep all the
non-static functions at the top of the file;
* Remove unnecessary extern and newlines from "init.h";
Signed-off-by: Tair Rzayev <tair.rzayev@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Chase Southwood [Thu, 22 May 2014 00:41:15 +0000 (19:41 -0500)]
staging: comedi: addi_apci_1564: move apci1564_do_insn_bits() to addi_apci_1564.c
This function is already compliant with the comedi API and is behaving as
comedi core expects. This patch moves it out of
addi-data/hwdrv_apci1564.c and into the driver proper since no further
work needs to be done on it.
Signed-off-by: Chase Southwood <chase.southwood@gmail.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>
Chase Southwood [Thu, 22 May 2014 00:40:09 +0000 (19:40 -0500)]
staging: comedi: addi_apci_1564: move apci1564_di_insn_bits() to addi_apci_1564.c
This function is already compliant with the comedi API and is behaving as
comedi core expects. This patch moves it out of
addi-data/hwdrv_apci1564.c and into the driver proper since no further
work needs to be done on it.
Signed-off-by: Chase Southwood <chase.southwood@gmail.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: ii_pci20kc: fix usage of uninit scalar in ii20k_attach()
This driver supports the PCI-20001C-1a and PCI-20001C-2a carrier boards.
The -2a version has 32 on-board DIO channels. In case this variant is
detected, local variable 'has_dio' is set accordingly. Otherwise it is
left uninitialized and the following subdevice instantiation depends on
the stack. Detected by Coverity - CID 1077830.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 6 May 2014 12:12:18 +0000 (13:12 +0100)]
staging: comedi: remove subdevice member of struct comedi_async
The `async` member of `struct comedi_subdevice` may point to a `struct
comedi_async` or may be NULL. The `subdevice` member of `struct
comedi_async` points back to the `struct comedi_subdevice` associated
with it in a one-to-one relationship.
All uses of the `subdevice` member of `struct comedi_async` apart from
its initialization have now been removed (by passing around a pointer to
the subdevice instead of to the "async" structure), so get rid of it.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 6 May 2014 12:12:17 +0000 (13:12 +0100)]
staging: comedi: mite: pass subdevice to mite_sync_output_dma()
`mite_sync_output_dma()` in the "mite" module currently takes a pointer
to a `struct comedi_async` and gets a pointer to the owning `struct
comedi_subdevice` from the `subdevice` member. Change it to take a
pointer to a `struct comedi_subdevice` and use the `async` member.
The motivation for this is to eliminate the `subdevice` member of
`struct comedi_async`.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 6 May 2014 12:12:16 +0000 (13:12 +0100)]
staging: comedi: mite: pass subdevice to mite_sync_input_dma()
`mite_sync_input_dma()` in the "mite" module currently takes a pointer
to a `struct comedi_async` and gets a pointer to the owning `struct
comedi_subdevice` from the `subdevice` member. Change it to take a
pointer to a `struct comedi_subdevice` and use the `async` member.
The motivation for this is to eliminate the `subdevice` member of
`struct comedi_async`.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 6 May 2014 12:12:15 +0000 (13:12 +0100)]
staging: comedi: mite: pass subdevice to mite_buf_change()
`mite_buf_change()` in the "mite" module currently takes a pointer to a
`struct comedi_async` and gets a pointer to the owning `struct
comedi_subdevice` from the `subdevice` member. Change it to take a
pointer to a `struct comedi_subdevice` and use the `async` member.
The motivation for this is to eliminate the `subdevice` member of
`struct comedi_async`.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 6 May 2014 12:12:14 +0000 (13:12 +0100)]
staging: comedi: pass subdevice to comedi_buf_write_n_available()
Local function `comedi_buf_write_n_available()` currently takes a
pointer to a `struct comedi_async`. Change it to take a pointer to a
`struct comedi_subdevice` and use the `async` member for consistency
with the other comedi buffer handling functions.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 6 May 2014 12:12:13 +0000 (13:12 +0100)]
staging: comedi: pass subdevice to __comedi_buf_write_alloc()
Local function `__comedi_buf_write_alloc()` is called by
`comedi_buf_write_alloc()` and `comedi_buf_put()`. It currently takes a
pointer to a `struct comedi_async`. Change it to take a pointer to a
`struct comedi_subdevice` and use the `async` member for consistency
with other comedi buffer handling functions.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 6 May 2014 12:12:12 +0000 (13:12 +0100)]
staging: comedi: pass subdevice to comedi_buf_munge()
Local function `comedi_buf_munge()` is called by
`comedi_buf_write_free()` to modify (or "munge") the data copied from
a device into the buffer.
Currently, the function takes a pointer to a `struct comedi_async` and
gets a pointer to the comedi subdevice from the `subdevice` member.
Change it to take a pointer to a `struct comedi_subdevice` and get a
pointer to the "async" structure from the `async` member.
The main motivation for this is to elimate the `subdevice` member of
`struct comedi_async`.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 6 May 2014 12:12:11 +0000 (13:12 +0100)]
staging: comedi: pass subdevice to comedi_buf_is_mmapped()
Change the parameters of `comedi_buf_is_mmapped()` to pass a pointer to
the comedi subdevice instead of a pointer to the "async" structure
belonging to the subdevice.
The main aim at the moment is to replace all the `struct comedi_async *`
parameters with `struct comedi_subdevice *` parameters in the comedi
driver API.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 6 May 2014 12:12:10 +0000 (13:12 +0100)]
staging: comedi: pass subdevice to comedi_buf_reset()
Change the parameters of `comedi_buf_reset()` to pass a pointer to the
comedi subdevice instead of a pointer to the "async" structure belonging
to the subdevice.
The main aim at the moment is to replace all the `struct comedi_async *`
parameters with `struct comedi_subdevice *` parameters in the comedi
driver API.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>