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>
Daeseok Youn [Fri, 16 May 2014 09:29:44 +0000 (18:29 +0900)]
staging: ozwpan: remove redundant NULL check for devs
The "devs" is a pointer to g_net_dev in ozmain.c.
g_net_dev has a default value as empty string.
So "devs" cannot be NULL, removes NULL check for "devs".
drivers/staging/lustre/lustre/obdclass/llog_ioctl.c:388:39: error: incompatible types for operation (>)
drivers/staging/lustre/lustre/obdclass/llog_ioctl.c:388:39: left side has type char *ioc_inlbuf2
drivers/staging/lustre/lustre/obdclass/llog_ioctl.c:388:39: right side has type int
Signed-off-by: Andreas Platschek <platschek@ict.tuwien.ac.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Zi Shen Lim [Mon, 12 May 2014 03:37:23 +0000 (20:37 -0700)]
staging/lustre: fix sparse warnings in o2iblnd_cb.c
This patch fixes the following sparse warnings:
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:44:1: warning: symbol 'kiblnd_tx_done' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:102:10: warning: symbol 'kiblnd_get_idle_tx' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:131:1: warning: symbol 'kiblnd_drop_rx' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:212:10: warning: symbol 'kiblnd_find_waiting_tx_locked' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:238:1: warning: symbol 'kiblnd_handle_completion' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:277:1: warning: symbol 'kiblnd_send_completion' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:296:1: warning: symbol 'kiblnd_handle_rx' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:457:1: warning: symbol 'kiblnd_rx_complete' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:527:13: warning: symbol 'kiblnd_kvaddr_to_page' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:699:1: warning: symbol 'kiblnd_setup_rd_iov' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:752:1: warning: symbol 'kiblnd_setup_rd_kiov' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:792:1: warning: symbol 'kiblnd_post_tx_locked' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:996:1: warning: symbol 'kiblnd_tx_complete' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1270:1: warning: symbol 'kiblnd_connect_peer' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1627:1: warning: symbol 'kiblnd_reply' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1814:1: warning: symbol 'kiblnd_thread_fini' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1828:1: warning: symbol 'kiblnd_peer_notify' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1934:1: warning: symbol 'kiblnd_handle_early_rxs' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1957:1: warning: symbol 'kiblnd_abort_txs' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1993:1: warning: symbol 'kiblnd_finalise_conn' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:2167:1: warning: symbol 'kiblnd_reject' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:2178:1: warning: symbol 'kiblnd_passive_connect' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:2452:1: warning: symbol 'kiblnd_reconnect' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:2516:1: warning: symbol 'kiblnd_rejected' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:2655:1: warning: symbol 'kiblnd_check_connreply' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:2754:1: warning: symbol 'kiblnd_active_connect' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:3025:1: warning: symbol 'kiblnd_check_conns' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:3108:1: warning: symbol 'kiblnd_disconnect_conn' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:3247:1: warning: symbol 'kiblnd_complete' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:904:20: warning: context imbalance in 'kiblnd_post_tx_locked' - unexpected unlock
Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peng Tao [Sun, 4 May 2014 07:45:50 +0000 (15:45 +0800)]
staging/lustre: remove Peng Tao from Lustre contact list
I am leaving emc for a new company where I cannot have much
time working on Lustre. So remove myself from the contact
list. I will still be around and continue to contribute as a
hobbyist though.
Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <bergwolf@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: binder: fix usage of uninit scalar in binder_transaction()
Fix the error path when a cookie mismatch is detected. In that case the
function jumps to the exit label without setting the uninitialized, local
variable 'return_error'. Detected by Coverity - CID 201453.
Roger writes:
Since all patches have been applied and the device is now
supported by the new driver, would you remove the former staging
one at drivers/staging/rts5139?
Cc: Roger Tseng <rogerable@realtek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
WARNING: Missing a blank line after declarations
#160: FILE: drivers/staging/imx-drm/imx-hdmi.c:160:
+ u8 val = hdmi_readb(hdmi, reg) & ~mask;
+ val |= data & mask;
WARNING: Missing a blank line after declarations
#1609: FILE: drivers/staging/imx-drm/imx-hdmi.c:1609:
+ const struct platform_device_id *device_id = of_id->data;
+ hdmi->dev_type = device_id->driver_data;
total: 0 errors, 2 warnings, 1767 lines checked
drivers/staging/imx-drm/imx-hdmi.c has style problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
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> Acked-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: silicom: Remove unused pointer in bypass_init_module()
Pointer 'pbpctl_dev_c' in function bypass_init_module() is unused. Thus remove
it. With the last variable declaration gone, there is no more need for an own
block. Remove it and adapt the indenting accordingly.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: silicom: Remove needless calls of get_status_port_fn()
Remove a needless pointer initialisation and call to get_status_port_fn()
in functions remove_bypass_tpl_auto() and set_tpl_fn(). Variable
'pbpctl_dev_b' is set correctly later in the function before first use.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Daeseok Youn [Fri, 9 May 2014 14:54:08 +0000 (23:54 +0900)]
staging: cxt1e1: remove dead code in musycc.c
Removes "#if 0" blocks.
And the musycc_dump_rxbuffer_ring(ch, 0) which is commented
out puts in RLD_DEBUG block and uncommented.
Because this function may be used for debugging.
staging: panel: (coding style) Line alignments and malloc sizeof
Style-only modifications to comply with checkpatch.pl --strict --file.
. Correctly realigns the lines that needed to be ;
. Suppress useless blank rows ;
. Fix sizeof() issues in various -malloc() functions.
Signed-off-by: Dominique van den Broeck <domdevlin@free.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
These issues have been fixed by a concurrent patch:
. missing inclusions of needed header files (fixed by concurrent patch);
. unrequired static function declaration (confusing another *.c file).
Signed-off-by: Dominique van den Broeck <domdevlin@free.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Larry Finger [Thu, 17 Apr 2014 15:35:22 +0000 (10:35 -0500)]
staging: r8188eu: Fix some sparse warnings
In a patch entitles "staging: r8188eu: Fix case where ethtype was never obtained
and always be checked against 0" (commit ID unknown), I introduce an endian error.
This patch fixes that, and removes two additional sparse warnings.
drivers/staging/rtl8188eu/core/rtw_recv.c:653:6: warning: symbol 'process_pwrbit_data' was not declared. Should it be static?
drivers/staging/rtl8188eu/core/rtw_recv.c:1828:5: warning: symbol 'enqueue_reorder_recvframe' was not declared. Should it be static?
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Cc: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ken Cox [Thu, 22 May 2014 17:31:12 +0000 (12:31 -0500)]
Staging: unisys: Remove unused macros from visorchannel/visorchannel.h
VISORCHANNEL_CHANGE_SERVER_STATE and VISORCHANNEL_CHANGE_CLIENT_STATE
are never used in any of the source so they have been removed.
VISORCHANNEL_CHANGE_CLIENT_STATE would have caused a broken kernel build
after commit a8d7f21d, but since it was never used the kernel continued
to build.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Ken Cox <jkc@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
David Matlack [Fri, 23 May 2014 04:38:45 +0000 (21:38 -0700)]
staging: slicoss: handle errors from slic_config_get
slic_config_get() can fail. Change the return type from void to
int and handle the error in slic_card_init(). So now, instead of
silently failing (and then timing out waiting for the config data),
the driver will fail loudly at request time.
Signed-off-by: David Matlack <matlackdavid@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
David Matlack [Tue, 20 May 2014 05:04:00 +0000 (22:04 -0700)]
staging: slicoss: fail on corrupt eeprom
Remove fail_on_bad_eeprom, which was always 0 and thus being used
to ignore incorrect checksumming. This means devices with corrupt
eeprom will now cause the driver to fail.
Since fail_on_bad_eeprom was the last member in use of struct
slic_reg_params, remove that struct altogether.
Signed-off-by: David Matlack <matlackdavid@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
David Matlack [Tue, 20 May 2014 05:03:59 +0000 (22:03 -0700)]
staging: slicoss: fix eeprom checksum code
Rewrite slic_eeprom_cksum() to fix bugs and make readable. This patch
technically has no effect on the user as failed eeprom checksums are
ignored anyway.
The original implementation had the following issues:
1. 2 of the 3 unrolled loops had the following bug:
while ((len -= 32) >= 0) {
[...]
sum += w[15];
w = (u16 *)((ulong) w + 16); /* verify */
}
This processes 32-bytes of data but only increments the word
pointer by 16 bytes. Fixing both of these bugs seems to fix
slic_eeprom_cksum().
2. Non-descriptive variable names, use of unions, and macros that
change local state make the code difficult to read.
3. The checksum loop is unrolled which makes the code harder to
reason about while providing small performance improvement:
- max eeprom length is 0x80 bytes (MAX_EECODE_SIZE), that's
only 0x40 iterations
- checksum is only computed during pci probe(), so not very
often
Tested on Mojave card
Signed-off-by: David Matlack <matlackdavid@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
David Matlack [Tue, 6 May 2014 04:02:37 +0000 (21:02 -0700)]
staging: slicoss: fix use-after-free bug in slic_entry_remove
This patch fixes a use-after-free bug that causes a null pointer
dereference in slic_entry_halt.
Since unregister_netdev() will ultimately call slic_entry_halt (the
net_device ndo_stop() virtual function for this device), we should
call it before freeing the memory used by slic_entry_halt.
Signed-off-by: David Matlack <dmatlack@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
David Matlack [Tue, 6 May 2014 04:02:36 +0000 (21:02 -0700)]
staging: slicoss: fix 64-bit isr address bug
This patch fixes a bug that only manifests when the physical address of
the interrupt status register is >4GB. Specifically, the driver was only
telling the device about the lower 32 bits of the ISR. This patch adds
the upper 32 bits.
Signed-off-by: David Matlack <dmatlack@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
David Matlack [Tue, 6 May 2014 04:02:35 +0000 (21:02 -0700)]
staging: slicoss: fix dma memory leak
This patch fixes a memory leak in slic_card_init. If the driver fails
to poll for an interrupt after requesting config data from the device
the dma memory is never freed.
Signed-off-by: David Matlack <dmatlack@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
As per the TODO file, this patch removes the gratuitous debug
infrastructure. As an extra incentive for removing this code,
the debugfs files are not cleaned up properly. For example, if
register_netdev() fails in slic_entry_probe() then all debugfs
files get left behind, even after the driver module is unloaded.
Touching these files quickly leads to an oops.
Signed-off-by: David Matlack <dmatlack@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
David Matlack [Tue, 6 May 2014 04:02:32 +0000 (21:02 -0700)]
staging: slicoss: fix multiple free-after-free in slic_entry_remove
This patch fixes two free-after-free bugs in slic_entry_remove.
Specifically, slic_unmap_mmio_space() iounmaps adapter->slic_regs,
which is the same region of memory as dev->base_addr (iounmap-ed
a few lines later).
Next, both release_mem_region() and pci_release_regions() are called
on the same pci_dev struct.
Signed-off-by: David Matlack <dmatlack@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
David Matlack [Tue, 6 May 2014 04:02:31 +0000 (21:02 -0700)]
staging: slicoss: fix use-after-free in slic_entry_probe
This patch fixes a use-after-free bug that can cause a kernel
oops. If slic_card_init fails then slic_entry_probe (the pci
probe() function for this device) will return error without
cleaning up memory.
Signed-off-by: David Matlack <dmatlack@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jes Sorensen [Wed, 21 May 2014 07:38:31 +0000 (09:38 +0200)]
staging: rtl8723au: rtw_cfg80211_monitor_if_xmit_entry() use struct ieee80211_mgmt
Use struct ieee80211_mgmt to parse action frame. In addition remove
unused functions rtw_cfg80211_rx_p2p_action_public() and
rtw_cfg80211_rx_action_p2p()