History log of /linux-master/drivers/staging/rtl8712/rtl8712_cmd.c
Revision Date Author Comments
# e230a445 30-Aug-2022 Dan Carpenter <dan.carpenter@oracle.com>

staging: rtl8712: fix use after free bugs

_Read/Write_MACREG callbacks are NULL so the read/write_macreg_hdl()
functions don't do anything except free the "pcmd" pointer. It
results in a use after free. Delete them.

Fixes: 2865d42c78a9 ("staging: r8712u: Add the new driver to the mainline kernel")
Cc: stable <stable@kernel.org>
Reported-by: Zheng Wang <hackerzheng666@gmail.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/Yw4ASqkYcUhUfoY2@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 99d7ef1e 19-Oct-2021 Eric W. Biederman <ebiederm@xmission.com>

exit/rtl8712: Replace the macro thread_exit with a simple return 0

The macro thread_exit is called is at the end of a function started
with kthread_run. The code in kthread_run has arranged things so a
kernel thread can just return and do_exit will be called.

So just have the cmd_thread return instead of calling complete_and_exit.

Link: https://lkml.kernel.org/r/20211020174406.17889-19-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>


# eff810f8 09-Jun-2021 Fabio M. De Francesco <fmdefrancesco@gmail.com>

staging: rtl8712: Replace printk() with netdev_dbg()

Replaced printk() with netdev_dbg() because the latter is preferred in
network devices drivers.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20210609135659.4054-1-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 54fd727f 05-Jun-2021 Fabio M. De Francesco <fmdefrancesco@gmail.com>

staging: rtl8712: Remove unnecessary alias of printk()

This module defines four alias for printk(). Removed them
all, because they are not used anywhere else in the driver.
Converted the only exception to the explicit use of printk().

Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20210606034038.9657-1-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1c8a4f7c 07-Aug-2019 Nishka Dasgupta <nishkadg.linux@gmail.com>

staging: rtl8712: Remove while loop and check_cmd_fifo()

Remove while loop as it only runs while the function check_cmd_fifo
returns _FAIL, whereas check_cmd_fifo always returns _SUCCESS (and hence
this loop will never run).
Remove now unused function check_cmd_fifo.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Link: https://lore.kernel.org/r/20190808064012.12661-9-nishkadg.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7c93fdf0 22-Jul-2019 Nishka Dasgupta <nishkadg.linux@gmail.com>

staging: rtl8712: r8712_register_cmd_alive(): Change return values

Change return values of r8712_register_cmd_alive from _SUCCESS and _FAIL
to 0 and -EINVAL.
Change the return type of this function from sint to int.
Modify its call site to check for 0 instead of _SUCCESS.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Link: https://lore.kernel.org/r/20190722092341.21030-4-nishkadg.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 22c971db 21-Mar-2019 Dan Carpenter <dan.carpenter@oracle.com>

staging: rtl8712: uninitialized memory in read_bbreg_hdl()

Colin King reported a bug in read_bbreg_hdl():

memcpy(pcmd->rsp, (u8 *)&val, pcmd->rspsz);

The problem is that "val" is uninitialized.

This code is obviously not useful, but so far as I can tell
"pcmd->cmdcode" is never GEN_CMD_CODE(_Read_BBREG) so it's not harmful
either. For now the easiest fix is to just call r8712_free_cmd_obj()
and return.

Fixes: 2865d42c78a9 ("staging: r8712u: Add the new driver to the mainline kernel")
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5b8d98f1 03-Mar-2019 Himadri Pandya <himadri18.07@gmail.com>

staging: rtl8712: rename bSurpriseRemoved to surprise_removed

- Rename structure field bSurprisedRemoved to surprised_removed to avoid
camelcase. Suggested by checkpatch.
- Change type to bool as the variable is used as a boolean.

Signed-off-by: Himadri Pandya <himadri18.07@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0ec6fc6f 03-Mar-2019 Himadri Pandya <himadri18.07@gmail.com>

staging: rtl8712: rename bDriverStopped to driver_stopped

- Rename structure field bDriverStopped to driver_stopped to avoid
camelcase. Suggested by checkpatch.
- Change type to bool as the variable is being used as boolean.

Signed-off-by: Himadri Pandya <himadri18.07@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e24c1f86 03-Oct-2018 Michael Straube <straube.linux@gmail.com>

staging: rtl8712: add SPDX identifiers

This satisfies a checkpatch warning and is the preferred
method for notating the license.

The SPDX identifier is a legally binding shorthand, which
can be used instead of the full boiler plate text.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 500320b7 02-Mar-2018 Arushi Singhal <arushisinghal19971997@gmail.com>

staging: rtl8712: remove unnecessary parentheses

Remove unnecessary parentheses around variables to conform to the Linux
kernel coding style. Issue found using checkpatch.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3be4fdf6 18-Dec-2017 Martin Homuth <martin@martinhomuth.de>

staging: rtl8712: style fix over 80 characters warnings

This patch fixes various coding style issues in the rtl8712 module as
noted by checkpatch.pl by reducing the characters per line to under
80.

It fixes the following checkpatch.pl warning:

WARNING: line over 80 characters

Signed-off-by: Martin Homuth <martin@martinhomuth.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a7e58591 11-Sep-2017 Liam Ryan <liamryandev@gmail.com>

staging: rtl8712: Fix unbalanced braces around else statement

Fix checkpath-reported unbalanced braces in the following areas

221: FILE: drivers/staging/rtl8712/hal_init.c:221:
392: FILE: drivers/staging/rtl8712/os_intfs.c:392:
363: FILE: drivers/staging/rtl8712/rtl8712_cmd.c:363:
889: FILE: drivers/staging/rtl8712/rtl8712_recv.c:889:
902: FILE: drivers/staging/rtl8712/rtl871x_cmd.c:902:
84: FILE: drivers/staging/rtl8712/rtl871x_ioctl_set.c:84:
580: FILE: drivers/staging/rtl8712/rtl871x_mlme.c:580:
593: FILE: drivers/staging/rtl8712/usb_intf.c:593:

Signed-off-by: Liam Ryan <liamryandev@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1e1858cb 06-Jul-2017 Arushi Singhal <arushisinghal19971997@gmail.com>

staging: rtl8712: fix "Alignment match open parenthesis"

Fix checkpatch issues: "CHECK: Alignment should match open parenthesis".

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3f07c014 08-Feb-2017 Ingo Molnar <mingo@kernel.org>

sched/headers: Prepare for new header dependencies before moving code to <linux/sched/signal.h>

We are going to split <linux/sched/signal.h> out of <linux/sched.h>, which
will have to be picked up from other headers and a couple of .c files.

Create a trivial placeholder <linux/sched/signal.h> file that just
maps to <linux/sched.h> to make this patch obviously correct and
bisectable.

Include the new header in the files that are going to need it.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>


# bcb91a5c 20-Dec-2016 Jannik Becher <becher.jannik@gmail.com>

staging: rtl8712: changed function argument to __le32

Fixed a sparse warning "cast to restricted __le32".
Function argument is of type __le32.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e8cd841b 20-Dec-2016 Jannik Becher <becher.jannik@gmail.com>

staging: rtl8712: changed variables to __le32

Fixed sparse warning "cast to restricted __le32".
Changed struct tx_desc members to __le32 and pcmdbuf to __le32.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5c2ba8b8 21-Aug-2016 Binoy Jayan <binoy.jayan@linaro.org>

rtl8712: pwrctrl_priv: Replace semaphore lock with mutex

The semaphore 'lock' in 'pwrctrl_priv' is used as a simple mutex, so it
should be written as one. Semaphores are going away in the future.
_enter_pwrlock was using down_interruptible(), so the lock could be broken
by sending a signal. This could be a bug, because nothing checks the return
code here. Hence, using mutex_lock instead of the interruptible version.
Removing the now unused _enter_pwrlock and _down_sema.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 204a8ac1 01-Jun-2016 Binoy Jayan <binoy.jayan@linaro.org>

rtl8712: Replace semaphore terminate_cmdthread_sema with completion

The semaphore 'terminate_cmdthread_sema' is used as completion,
so convert it to a struct completion type.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0f89054a 01-Jun-2016 Binoy Jayan <binoy.jayan@linaro.org>

rtl8712: Replace semaphore cmd_queue_sema with completion

The semaphore 'cmd_queue_sema' is used as completion,
so convert it to a struct completion type.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7fcf92c0 13-Mar-2016 Juliana Rodrigues <juliana.orod@gmail.com>

staging: rtl8712: rtl8712_cmd.c: fixed comparison to null

This patch fixes multiple "comparison to NULL"
checkpatch.pl issues:

CHECK: Comparison to NULL could be written "!pcmd"
+ if (pcmd == NULL)

Signed-off-by: Juliana Rodrigues <juliana.orod@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 56238e45 20-Feb-2016 Bhaktipriya Shridhar <bhaktipriya96@gmail.com>

staging: rtl8712: Remove cast on void pointer

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T *)x)->f
|
- (T *)
e
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 97e2ba90 28-Jan-2016 Rakhi Sharma <rakhish1994@gmail.com>

Staging: rtl8712: rtl8712_cmd: Fixed a warning.

Warning:Comparisons should place the constant on the right side of the test
Fixed by placing the comparisions constant on right side of the test.

Signed-off-by: Rakhi Sharma <rakhish1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4ef2de5a 19-Oct-2015 Luis de Bethencourt <luisbg@osg.samsung.com>

staging: rtl8712: spaces preferred around operands

Clean up all instances of checkpatch.pl checks:
CHECK: spaces preferred around that '+'
(and other operands)

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 168a2c10 19-Oct-2015 Luis de Bethencourt <luisbg@osg.samsung.com>

staging: rtl8712: braces should be used on all arms

Fix all instances of the following checkpatch.pl check:
CHECK: braces {} should be used on all arms of this statement

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1ca96884 19-Oct-2015 Luis de Bethencourt <luisbg@osg.samsung.com>

staging: rtl8712: Remove boolean comparisons

Boolean tests do not need explicit comparison to true or false.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# adc08cc4 14-Oct-2015 Shivani Bhardwaj <shivanib134@gmail.com>

Staging: rtl8712: rtl8712_cmd: Remove useless cast

Explicit type conversions are not required so, remove them.
Semantic patch used:
@@
type T;
T e;
identifier x;
@@

* T x = (T)e;

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ed9c838a 07-Oct-2015 Punit Vara <punitvara@gmail.com>

Staging: rtl8712: rtl8712_cmd.c: Coding style warnings fix for block comments

This is patch to the rtl8712_cmd.c file that fixes up following warning
reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ae52e527 26-Feb-2015 Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>

staging: rtl8712: rewrite the right hand side of an assignment

This patch rewrites the right hand side of an assignment for
expressions of the form:
a = (a <op> b);
to be:
a <op>= b;
where <op> = << | >>.

This issue was detected and resolved using the following
coccinelle script:

@@
identifier i;
expression e;
@@

-i = (i >> e);
+i >>= e;

@@
identifier i;
expression e;
@@

-i = (i << e);
+i <<= e;

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e29d3ebc 27-Oct-2014 Sudip Mukherjee <sudipm.mukherjee@gmail.com>

staging: rtl8712: remove unused variables

unused variables are removed. These variables were only assigned some
values and after that they were never being used. So they are safe to
be removed , and it has been build tested.

I left a call to r8712_read32(padapter, TCR) and
r8712_read8(padapter, SDIO_HCPWM) .

r8712_read32() and r8712_read8() is ultimately calling usb_read32()
and usb_read8() respectively. and they are again calling
r8712_usbctrl_vendorreq().
this r8712_usbctrl_vendorreq() is communicating through the usb bus
and is sending and receiving the control msg.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 02a29d2d 24-Sep-2014 Tapasweni Pathak <tapaswenipathak@gmail.com>

staging: rtl8712: add new line after declarations

This patch fixes checkpatch.pl warning in hal_init.c file
WARNING : Missing a blank line after declarations

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 57b6686e 20-Sep-2014 Tapasweni Pathak <tapaswenipathak@gmail.com>

Staging: rtl8712 : Fix line over 80 characters

This patch fixes checkpatch.pl warning in files of rtl8712
WARNING : line over 80 characters

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# fee51243 09-Jul-2014 James A Shackleford <shack@linux.com>

staging: rtl8712: remove wrapper function thread_enter()

The inline function thread_enter() accepts a single ignored parameter and is
just a wrapper for allow_signal(SIGTERM). Removed.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# df353f61 24-Jun-2014 James A Shackleford <shack@linux.com>

staging: rtl8712: remove wrapper function _queue_empty

_queue_empty is an inline wrapper around list_empty. This patch removes this
wrapper function and instead calls list_empty directly.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d913e54e 22-Jun-2014 James A Shackleford <shack@linux.com>

staging: rtl8712: remove inline _RND8() and use round_up()

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8ffca9ea 19-May-2014 Peter Senna Tschudin <peter.senna@gmail.com>

staging: r8712u: Remove useless return variables

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>


# 885a947e 10-Dec-2013 Paul Gortmaker <paul.gortmaker@windriver.com>

staging: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>. Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 77e73e8c 01-Oct-2013 Thomas Cort <linuxgeek@gmail.com>

Staging: rtl8712: fix spaces before semicolons

Resolve all of the 'WARNING: space prohibited before semicolon'
checkpatch warnings for rtl8712.

Signed-off-by: Thomas Cort <linuxgeek@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a376932a 27-Sep-2013 Dan Carpenter <dan.carpenter@oracle.com>

staging: rtl8712: remove unneeded NULL check

We knew "peventbuf" was a valid pointer and "peventbuf + 2" is also
non-NULL. I have removed the check.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9a0fbbb5 09-May-2012 Paul Gortmaker <paul.gortmaker@windriver.com>

staging: delete all duplicated endian crap from rtl8712 driver

This driver had headers like big_endian.h, little_endian.h, swab.h
and yet we can throw them all in the trash can and the thing
still builds on x86-64 and ppc, just by deleting the references
to the deleted files.

Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>


# be10ac2b 07-May-2012 Justin P. Mattock <justinmattock@gmail.com>

staging: rtl8712: Fix typos.

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 359140aa 03-Sep-2011 Ali Bahar <ali@internetdog.org>

staging: r8712u: Merging Realtek's latest (v2.6.6). Updated include directives.

These are the new include directives for header files.
The following were (somehow!) not explicity in Realtek's, but proved necessary:
"linux/usb.h" is needed for usb_alloc_urb();
"linux/interrupt.h" is needed for tasklet_struct. It was often a nested
include.

Signed-off-by: Ali Bahar <ali@internetDog.org>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 2865d42c 20-Aug-2010 Larry Finger <Larry.Finger@lwfinger.net>

staging: r8712u: Add the new driver to the mainline kernel

This code is for a completely new version of the Realtek 8192 USB devices
such as the D-Link DWA-130. The Realtek code, which was originally for
Linux, Windows XP and Windows CE, has been stripped of all code not needed
for Linux. In addition, only one additional configuration variable, which
enables AP mode, remains.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Tested-by: Frederic Leroy <fredo@starox.org>