Commit graph

1525 commits

Author SHA1 Message Date
Haowen Bai
37a3929feb staging: rtl8192e: remove null check after call container_of()
container_of() will never return NULL, so remove useless code.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Link: https://lore.kernel.org/r/1652696403-17852-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-19 17:42:43 +02:00
Solomon Tan
a7d1a80671 staging: rtl8192e: Remove u16 cast for u16 return value
Remove explicit u16 cast of the function Mk16 return value.
The variable hi does not need to be casted explicitly to u16 as it will
already be casted implicitly.

Signed-off-by: Solomon Tan <wjsota@gmail.com>
Link: https://lore.kernel.org/r/20220423130150.161903-8-wjsota@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-26 11:35:19 +02:00
Solomon Tan
c9c5f7e02b staging: rtl8192e: Remove u16 cast for u32 parameter
The explicit u16 cast is not necessary because rtl92e_eeprom_read's
second parameter is defined to be u32.

Signed-off-by: Solomon Tan <wjsota@gmail.com>
Link: https://lore.kernel.org/r/20220423130150.161903-7-wjsota@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-26 11:35:18 +02:00
Solomon Tan
bd0b9adf35 staging: rtl8192e: Remove unnecessary u16 argument cast
Remove the explicit u16 casts for u16 argument in the function call. This
function has declared its parameter to be of type u16, so the argument
given to that parameter will be automatically coerced to u16. Therefore,
an explicit cast is unnecessary.

Signed-off-by: Solomon Tan <wjsota@gmail.com>
Link: https://lore.kernel.org/r/20220423130150.161903-6-wjsota@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-26 11:35:18 +02:00
Solomon Tan
0bc8b4b97b staging: rtl8192e: Remove unnecessary u16 assignment cast
Remove the explicit casts in assignment statements for u16 variables.
Because these variables are declared as u16, there is implicit
conversion to u16 during the assignment, so an explicit cast is
unnecessary.

Signed-off-by: Solomon Tan <wjsota@gmail.com>
Link: https://lore.kernel.org/r/20220423130150.161903-5-wjsota@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-26 11:35:18 +02:00
Solomon Tan
d9ad805083 staging: rtl8192e: Remove unnecessary u8 cast in comparison
Since the macro VERSION_8190_BD is defined to be 0x3, and the structure
members card_8192_version and IC_Cut are both u8, an explicit u8 cast is
unnecessary.

Signed-off-by: Solomon Tan <wjsota@gmail.com>
Link: https://lore.kernel.org/r/20220423130150.161903-4-wjsota@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-26 11:35:18 +02:00
Solomon Tan
46176f28c0 staging: rtl8192e: Remove unnecessary u8 argument cast
Remove the unnecessary explicit u8 casts for u8 arguments in function
calls. These functions have declared their parameters to be of type u8,
so the arguments given to those parameters will be automatically coerced
to u8. Therefore, an explicit cast is unnecessary.

Signed-off-by: Solomon Tan <wjsota@gmail.com>
Link: https://lore.kernel.org/r/20220423130150.161903-3-wjsota@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-26 11:35:18 +02:00
Solomon Tan
20400df1e4 staging: rtl8192e: Remove unnecessary u8 assignment cast
Remove the explicit casts in assignment statements for u8 variables.
Because these variables are declared as u8, there is implicit conversion
to u8 during the assignment, so an explicit cast is unnecessary.

Signed-off-by: Solomon Tan <wjsota@gmail.com>
Link: https://lore.kernel.org/r/20220423130150.161903-2-wjsota@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-26 11:35:18 +02:00
Haowen Bai
97042d0a75 staging: rtl8192e: Fix signedness bug in rtllib_rx_assoc_resp()
The rtllib_rx_assoc_resp() function has a signedness bug because it's
a declared as a u16 but it return -ENOMEM.  When you look at it more
closely it returns a mix of error codes including 0xcafe, -ENOMEM, and
a->status which is WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG.  This is a mess.

Clean it up to just return standard kernel error codes.  We can print
out the a->status before returning a regular error code.  The printks
in the caller need to be adjusted as well.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Link: https://lore.kernel.org/r/1650529277-7893-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-22 16:42:30 +02:00
Solomon Tan
55de6cb7f8 staging: rtl8192e: Remove space after cast
This patch addresses the checkpatch.pl flag that there should not be a
space after a cast.

Signed-off-by: Solomon Tan <wjsota@gmail.com>
Link: https://lore.kernel.org/r/20220419124318.8028-1-wjsota@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-20 18:47:25 +02:00
Duoming Zhou
9b6bdbd933 drivers: staging: rtl8192e: Fix deadlock in rtllib_beacons_stop()
There is a deadlock in rtllib_beacons_stop(), which is shown
below:

   (Thread 1)              |      (Thread 2)
                           | rtllib_send_beacon()
rtllib_beacons_stop()      |  mod_timer()
 spin_lock_irqsave() //(1) |  (wait a time)
 ...                       | rtllib_send_beacon_cb()
 del_timer_sync()          |  spin_lock_irqsave() //(2)
 (wait timer to stop)      |  ...

We hold ieee->beacon_lock in position (1) of thread 1 and
use del_timer_sync() to wait timer to stop, but timer handler
also need ieee->beacon_lock in position (2) of thread 2.
As a result, rtllib_beacons_stop() will block forever.

This patch extracts del_timer_sync() from the protection of
spin_lock_irqsave(), which could let timer handler to obtain
the needed lock.

Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20220417141641.124388-1-duoming@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-20 18:47:24 +02:00
Davidlohr Bueso
f96f8ae08d staging/rtl8192e,ieee80211: replace ps tasklet with work
Tasklets have long been deprecated as being too heavy on the system
by running in irq context - and this is not a performance critical
path. If a higher priority process wants to run, it must wait for
the tasklet to finish before doing so.

rtllib_sta_ps() and ieee80211_sta_ps() will now run in process context
and have further concurrency (tasklets being serialized among themselves),
but this is done holding the ieee->lock, so it should be fine.

Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/20220411151620.129178-7-dave@stgolabs.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-12 15:53:51 +02:00
Alaa Mohamed
847a04d676 staging: rtl8192e: remove multiple blank lines
Reported by checkpatch:

CHECK: Please don't use multiple blank lines

Signed-off-by: Alaa Mohamed <eng.alaamohamedsoliman.am@gmail.com>
Link: https://lore.kernel.org/r/20220406154921.15532-1-eng.alaamohamedsoliman.am@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-07 19:52:39 +02:00
Colin Ian King
02d838dec8 staging: rtl8192e: Fix spelling mistake "RESQUEST" -> "REQUEST"
There is a spelling mistake in a netdev_dbg message. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20220315224037.2962063-1-colin.i.king@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-03-16 15:08:53 +01:00
Moses Christopher Bollavarapu
c4b5dfd840 staging: rtl8192e: use BIT macro instead of left shifting
There is a BIT(nr) macro available in vdso/bits.h
which is doing the same left shift operation

Example: (1 << 7) == BIT(7)

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Moses Christopher Bollavarapu <mosescb.dev@gmail.com>
Link: https://lore.kernel.org/r/20220219183234.31216-1-mosescb.dev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-21 18:13:37 +01:00
Linus Torvalds
22ef12195e Staging drivers update for 5.17-rc1
Here's the big set of staging driver updates for 5.17-rc1
 
 Nothing major in here at all, just lots and lots of tiny cleanups.
 Overall more code was removed than added, which is always nice, but
 not a huge change.
 
 Majority of the work happened in the r8188eu driver, that had hundreds
 of cleanups happen on it, but almost all other staging drivers had
 cleanups as well.  No new functionality was added, cleanups only.
 
 All of these have been in linux-next for a while with no reported
 problems.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCYd7SrQ8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ymohwCgi8+FwjSwfzLjOB8ZCtqZu0qs5AwAniCR080V
 1MhVDTkreXHR8mM+pz/3
 =QJRe
 -----END PGP SIGNATURE-----

Merge tag 'staging-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver updates from Greg KH:
 "Here's the big set of staging driver updates for 5.17-rc1

  Nothing major in here at all, just lots and lots of tiny cleanups.
  Overall more code was removed than added, which is always nice, but
  not a huge change.

  Majority of the work happened in the r8188eu driver, that had hundreds
  of cleanups happen on it, but almost all other staging drivers had
  cleanups as well. No new functionality was added, cleanups only.

  All of these have been in linux-next for a while with no reported
  problems"

* tag 'staging-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (308 commits)
  staging: r8188eu: rename camelcase variable uintPeerChannel
  staging: r8188eu: make BW20_24G_Diff a 1-D array
  staging: r8188eu: make OFDM_24G_Diff a 1-D array
  staging: r8188eu: BW40_24G_Diff is set but not used
  staging: r8188eu: CCK_24G_Diff is set but not used
  staging: r8188eu: make Index24G_BW40_Base a 1-D array
  staging: r8188eu: make Index24G_CCK_Base a 1-D array
  staging: r8188eu: rfPath is always 0
  staging: r8188eu: remove unneeded parameter from rtl8188e_SetHalODMVar
  staging: pi433: add comment to rx_lock mutex definition
  staging: pi433: fix frequency deviation check
  staging: vc04_services: rename BM2835 to BCM2835 in headers comments
  staging: vc04_services: rename string literal containing bm2835_* to bcm2835*_
  staging: vc04_services: rename variables containing bm2835_* to bcm2835_*
  staging: vc04_services: rename functions containing bm2835_* to bcm2835_*
  staging: vc04_services: rename structures bm2835_mmal_dev and bm2835_mmal_v4l2_ctrl
  staging: greybus: audio: Check null pointer
  staging: r8188eu: add spaces around P2P_AP_P2P_CH_SWITCH_PROCESS_WK
  staging: r8188eu: turbo scan is always off for r8188eu
  staging: r8188eu: cmd_issued_cnt is set but not used
  ...
2022-01-12 11:18:49 -08:00
Yang Yingliang
7de80b094e staging: rtl8192e: rtllib_module: remove unnecessary assignment
Remove the null pointer assignment after freeing 'ieee->pHTInfo'.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20211202030704.2425621-4-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03 15:09:49 +01:00
Yang Yingliang
e730cd57ac staging: rtl8192e: rtllib_module: fix error handle case in alloc_rtllib()
Some variables are leaked in the error handling in alloc_rtllib(), free
the variables in the error path.

Fixes: 94a799425e ("From: wlanfae <wlanfae@realtek.com>")
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20211202030704.2425621-3-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03 15:09:49 +01:00
Yang Yingliang
68bf78ff59 staging: rtl8192e: return error code from rtllib_softmac_init()
If it fails to allocate 'dot11d_info', rtllib_softmac_init()
should return error code. And remove unneccessary error message.

Fixes: 94a799425e ("From: wlanfae <wlanfae@realtek.com>")
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20211202030704.2425621-2-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03 15:09:49 +01:00
Jakub Kicinski
93d5404e89 Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
drivers/net/ipa/ipa_main.c
  8afc7e471a ("net: ipa: separate disabling setup from modem stop")
  76b5fbcd6b ("net: ipa: kill ipa_modem_init()")

Duplicated include, drop one.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-11-26 13:45:19 -08:00
Eric Dumazet
5337824f4d net: annotate accesses to queue->trans_start
In following patches, dev_watchdog() will no longer stop all queues.
It will read queue->trans_start locklessly.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-11-17 14:56:16 +00:00
Dan Carpenter
b535917c51 staging: rtl8192e: Fix use after free in _rtl92e_pci_disconnect()
The free_rtllib() function frees the "dev" pointer so there is use
after free on the next line.  Re-arrange things to avoid that.

Fixes: 66898177e7 ("staging: rtl8192e: Fix unload/reload problem")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20211117072016.GA5237@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-17 14:08:57 +01:00
Jakub Kicinski
e7c636f2bb staging: rtl: use eth_hw_addr_set()
Commit 406f42fa0d ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20211019171243.1412240-8-kuba@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-20 19:33:59 +02:00
Jakub Kicinski
349f631da4 staging: use eth_hw_addr_set() instead of ether_addr_copy()
Commit 406f42fa0d ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.

Convert staging from ether_addr_copy() to eth_hw_addr_set():

  @@
  expression dev, np;
  @@
  - ether_addr_copy(dev->dev_addr, np)
  + eth_hw_addr_set(dev, np)

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20211019171243.1412240-3-kuba@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-20 19:33:58 +02:00
Saurav Girepunje
11dc495619 staging: rtl8192e: remove unused variable ieee
Remove unused local variable ieee from ActivateBAEntry().

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
Link: https://lore.kernel.org/r/YVmAhOSRB8yc/iwU@user
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-05 12:30:50 +02:00
Tuo Li
25ee7e89d4 staging: rtl8192e: rtl_core: Fix possible null-pointer dereference in _rtl92e_pci_disconnect()
The variable dev is checked in:
  if (dev)

This indicates that it can be NULL. If so, a null-pointer dereference will
occur:
  priv = rtllib_priv(dev);

However, the value of priv is not used in the remaining part of this
function. Thus the else-branch can be removed to fix this posible
null-pointer dereference.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tuo Li <islituo@gmail.com>
Link: https://lore.kernel.org/r/20210811031135.4110-1-islituo@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-11 09:43:44 +02:00
Saurav Girepunje
3bb8fa376b staging: rtl8192e: rtl8192e: rtl_core: remove unused global variable
Remove unused global variable channels from rtl_core.c

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
Link: https://lore.kernel.org/r/20210807102232.6674-4-saurav.girepunje@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-10 12:15:14 +02:00
Kees Cook
ada0e6dbbb staging: rtl8192e: Avoid field-overflowing memcpy()
In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memcpy(), memmove(), and memset(), avoid
intentionally writing across neighboring fields.

Split the 3 addr memcpy() into 3 memcpy() calls so the compiler doesn't
think an overflowing memcpy() happens against the addr1 field (the
neighbors are intended to be copied as well).

rtllib_read_qos_param_element() copies a struct rtllib_info_element
into a struct rtllib_qos_information_element, but is actually wanting to
copy into the larger struct rtllib_qos_parameter_info (the contents of
ac_params_record[] is later examined). Refactor the routine to perform
centralized checks, and copy the entire contents directly (since the id
and len members match the elementID and length members):

struct rtllib_info_element {
        u8 id;
        u8 len;
        u8 data[];
} __packed;

struct rtllib_qos_information_element {
        u8 elementID;
        u8 length;
        u8 qui[QOS_OUI_LEN];
        u8 qui_type;
        u8 qui_subtype;
        u8 version;
        u8 ac_info;
} __packed;

struct rtllib_qos_parameter_info {
        struct rtllib_qos_information_element info_element;
        u8 reserved;
        struct rtllib_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
} __packed;

Cc: Darshan D V <darshandv10@gmail.com>
Cc: Aditya Srivastava <yashsri421@gmail.com>
Cc: devel@driverdev.osuosl.org
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210806201106.2871169-1-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-10 12:09:32 +02:00
Len Baker
cf79ee6eb0 staging/rtl8192e: Remove all strcpy() uses
strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading
to all kinds of misbehaviors. The safe replacement is strscpy().

It is also dangerous a strcpy() followed by a strcat(). In this case,
refactor the code using scnprintf() and avoid this combination.

Signed-off-by: Len Baker <len.baker@gmx.com>
Link: https://lore.kernel.org/r/20210723173216.12157-1-len.baker@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-27 15:20:56 +02:00
Thomas Bracht Laumann Jespersen
6ec070e872 staging: rtl8192e: Fix shadowed variable name
Fixes the following sparse warning:

drivers/staging/rtl8192e/rtllib_tx.c:884:32: warning: symbol 'tcb_desc' shadows an earlier one
drivers/staging/rtl8192e/rtllib_tx.c:569:24: originally declared here

Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
Link: https://lore.kernel.org/r/20210521193711.5457-1-t@laumann.xyz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-25 18:23:32 +02:00
Wang Qing
946c945301 staging: rtl8192e: delete extra blank lines
fixing CHECK:Blank lines aren't necessary before a close brace '}'

Signed-off-by: Wang Qing <wangqing@vivo.com>
Link: https://lore.kernel.org/r/1621393219-28665-1-git-send-email-wangqing@vivo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-19 17:59:39 +02:00
Ojaswin Mujoo
f6d5d11846 staging: rtl8192e: Fix whitespace around conditional statement
This patch fixes the following checkpatch.pl warnings:

- WARNING: suspect code indent for conditional statements (8, 17)
  FILE: ./rtl8192e/rtl8192e/rtl_dm.c:1735:

- WARNING: Statements should start on a tabstop
  FILE: ./rtl8192e/rtl8192e/rtl_dm.c:1736:

Signed-off-by: Ojaswin Mujoo <ojaswin98@gmail.com>
Link: https://lore.kernel.org/r/b25f07b14c7e1f0d70d54b8723f786e33ffeb77a.1620642396.git.ojaswin98@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10 14:37:04 +02:00
Ojaswin Mujoo
d0cf4e2bd4 staging: rtl8192e: Add identifier name to function definition
The patch fixes the following checkpatch.pl warnings:

- WARNING: function definition argument 'struct net_device *' should also
    have an identifier name
  FILE: ./rtl8192e/rtl8192e/rtl_core.h:572:

- WARNING: function definition argument 'struct net_device *' should also
    have an identifier name
  FILE: ./rtl8192e/rtl8192e/rtl_core.h:573:

Signed-off-by: Ojaswin Mujoo <ojaswin98@gmail.com>
Link: https://lore.kernel.org/r/d856d9f22777524f5c10bddb7f7930d97e58c20b.1620642396.git.ojaswin98@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10 14:37:04 +02:00
Ojaswin Mujoo
1ba6d8dc50 staging: rtl8192e: Avoid multiple line dereference
Avoid multiple line dereference to make the code more readable, as
suggested by checkpatch.pl

This patch fixes the following checkpatch.pl warning:

- WARNING: Avoid multiple line dereference
    prefer 'priv->rtllib->swcamtable[4].key_buf[0]'
  FILE: ./rtl8192e/rtl8192e/rtl_cam.c:189

- WARNING: Avoid multiple line dereference
    prefer 'priv->rtllib->swcamtable[4].key_buf[0]'
  FILE: ./rtl8192e/rtl8192e/rtl_cam.c:195

- WARNING: Avoid multiple line dereference
    prefer 'priv->rtllib->swcamtable[4].key_buf[0]'
  FILE: ./rtl8192e/rtl8192e/rtl_cam.c:204

- WARNING: Avoid multiple line dereference
    prefer 'priv->rtllib->swcamtable[4].key_buf[0]'
  FILE: ./rtl8192e/rtl8192e/rtl_cam.c:209

- WARNING: Avoid multiple line dereference
    prefer 'info_element->data[info_element->len]'
  FILE: ./rtl8192e/rtllib_rx.c:2287

Signed-off-by: Ojaswin Mujoo <ojaswin98@gmail.com>
Link: https://lore.kernel.org/r/435b60bd8874f8105b4af6e7eb9ee5bdbfe3112f.1620642396.git.ojaswin98@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10 14:37:04 +02:00
Saurav Girepunje
aaa27b88a5 staging: rtl8192e: Remove duplicate declartion
Remove dupilcate declartion of function rtllib_stop_send_beaconsi()
notify_wx_assoc_event() in rtl8192e/rtllib.h file.

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
Link: https://lore.kernel.org/r/20210509171427.GA9937@user
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10 14:35:28 +02:00
zhaoxiao
84b45d4ff9 staging: rtl8192e: replace comparison to NULL by bool
Fixed Comparison to NULL can be written as '!...' by replacing it with
simpler form i.e boolean expression. This makes code more readable alternative.
Reported by checkpatch.

Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com>
Link: https://lore.kernel.org/r/20210430125657.18264-1-zhaoxiao@uniontech.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10 11:19:34 +02:00
zhaoxiao
66d708e655 staging: rtl8192e: remove unnecesasry ftrace-like logging
Fixed Check: Remove unnecessary ftrace-like logging by simply deleting
that statement as we have other modes of logging like ftrace.
Reported by checkpatch.

Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com>
Link: https://lore.kernel.org/r/20210430122826.9899-1-zhaoxiao@uniontech.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10 11:19:34 +02:00
Ian Kewish
5cc8364494 staging: rtl8192e: indent statement properly
Indent statement in an else branch.  Reported by checkpatch:
WARNING:SUSPECT_CODE_INDENT: suspect code indent for
conditional statements (8, 8)

Signed-off-by: Ian Kewish <iankewish@gmail.com>
Link: https://lore.kernel.org/r/20210415180645.65699-1-iankewish@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-22 10:38:42 +02:00
Mitali Borkar
c567fb9da3 staging: rtl8192e: removed multiple blank lines
Removed multiple blank lines to make code better and neater.
Reported by checkpatch.

Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
Link: https://lore.kernel.org/r/2bfe551f152a611cc49a71a4984f41ef7ee69df5.1618380932.git.mitaliborkar810@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-14 10:30:55 +02:00
Mitali Borkar
e3a8607981 staging: rtl8192e: remove unnecessary blank line after close brace
Removed an extra blank line after close brace '{' as it was not
necessary.
Reported by checkpatch

Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
Link: https://lore.kernel.org/r/40f72a84750f402c342b4685e0a2f15d27875c9a.1618380932.git.mitaliborkar810@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-14 10:30:55 +02:00
Mitali Borkar
c7dabf1a45 staging: rtl8192e: remove unnecessary blank line before brace
Removed an extra blank line before close brace as it was not necessary.
Reported by checkpatch.

Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
Link: https://lore.kernel.org/r/cad6a7885f30dcfabaf1ccab1fd0644416fea194.1618380932.git.mitaliborkar810@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-14 10:30:55 +02:00
Mitali Borkar
3cc112a088 staging: rtl8192e: add spaces around binary operators
Added spaces around binary operators like '+', '*', '|', '-', '&',
to improve readability and to meet linux kernel coding style.

Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
Link: https://lore.kernel.org/r/28cbc4825fdfacf5d5ea8bb688a8bd6a1c65f059.1618380932.git.mitaliborkar810@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-14 10:30:54 +02:00
Mitali Borkar
cc444aa522 staging: rtl8192e: remove unnecessary ftrace-like logging
Removed unncessary ftrace-like logging by simply deleting that statement
as we have other modes of logging like ftrace.
Reported by checkpatch.

Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
Link: https://lore.kernel.org/r/460ba9cdd256bf1064c4e3a694caa046171cb60e.1618283232.git.mitaliborkar810@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-13 09:52:26 +02:00
Mitali Borkar
26be3a5d84 staging: rtl8192e: Fix incorrect pointer check
In commit 92172da23c ("staging: rtl8192e: replace comparison to NULL
by bool") a check was changed from looking at the data to the pointer,
which was incorrect, so revert that portion of the commit to have the
proper logic restored.

Reported-by: Julia Lawall <julia.lawall@inria.fr>
Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
Fixes: 92172da23c ("staging: rtl8192e: replace comparison to NULL by bool")
Link: https://lore.kernel.org/r/YHG8qARLUX2KPWwI@kali
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-11 08:36:13 +02:00
Mitali Borkar
08aa09135c staging: rtl8192e: remove unnecesasry f-trace like logging
Fixed Check: Remove unnecessary f-trace like logging by simply deleting
that statement as we have other modes of logging like ftrace.
Reported by checkpatch.

Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
Link: https://lore.kernel.org/r/YHDtWizzh5EVLL4/@kali
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-10 10:29:05 +02:00
Mitali Borkar
92172da23c staging: rtl8192e: replace comparison to NULL by bool
Fixed Comparison to NULL can be written as '!...' by replacing it with
simpler form i.e boolean expression. This makes code more readable alternative.
Reported by checkpatch.

Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
Link: https://lore.kernel.org/r/YHDnWpWztxeZospi@kali
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-10 10:28:57 +02:00
Jiapeng Chong
85adda6197 staging: rtl8192e: rtl8192E_dev: remove unused variable
Fix the following gcc warning:

drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:693:15: warning: variable
‘tmpRegC’ set but not used [-Wunused-but-set-variable].

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Link: https://lore.kernel.org/r/1617767558-114050-1-git-send-email-jiapeng.chong@linux.alibaba.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-07 10:20:18 +02:00
Deborah Brouwer
f52def0b5e staging: rtl8192e: move const after static
Move the const after static to conform with kernel preference for
static const <type> declaration style instead of static <type> const.
Identified by checkpatch: WARNING: Move const after static - use 'static
const char'.

Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com>
Link: https://lore.kernel.org/r/20210404222349.7218-1-deborahbrouwer3563@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-05 12:12:38 +02:00
Greg Kroah-Hartman
e5c7bccc37 Merge 5.12-rc6 into staging-next
We need the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-05 08:57:44 +02:00
Atul Gopinathan
e78836ae76 staging: rtl8192e: Change state information from u16 to u8
The "u16 CcxRmState[2];" array field in struct "rtllib_network" has 4
bytes in total while the operations performed on this array through-out
the code base are only 2 bytes.

The "CcxRmState" field is fed only 2 bytes of data using memcpy():

(In rtllib_rx.c:1972)
	memcpy(network->CcxRmState, &info_element->data[4], 2)

With "info_element->data[]" being a u8 array, if 2 bytes are written
into "CcxRmState" (whose one element is u16 size), then the 2 u8
elements from "data[]" gets squashed and written into the first element
("CcxRmState[0]") while the second element ("CcxRmState[1]") is never
fed with any data.

Same in file rtllib_rx.c:2522:
	 memcpy(dst->CcxRmState, src->CcxRmState, 2);

The above line duplicates "src" data to "dst" but only writes 2 bytes
(and not 4, which is the actual size). Again, only 1st element gets the
value while the 2nd element remains uninitialized.

This later makes operations done with CcxRmState unpredictable in the
following lines as the 1st element is having a squashed number while the
2nd element is having an uninitialized random number.

rtllib_rx.c:1973:    if (network->CcxRmState[0] != 0)
rtllib_rx.c:1977:    network->MBssidMask = network->CcxRmState[1] & 0x07;

network->MBssidMask is also of type u8 and not u16.

Fix this by changing the type of "CcxRmState" from u16 to u8 so that the
data written into this array and read from it make sense and are not
random values.

NOTE: The wrong initialization of "CcxRmState" can be seen in the
following commit:

commit ecdfa44610 ("Staging: add Realtek 8192 PCI wireless driver")

The above commit created a file `rtl8192e/ieee80211.h` which used to
have the faulty line. The file has been deleted (or possibly renamed)
with the contents copied in to a new file `rtl8192e/rtllib.h` along with
additional code in the commit 94a799425e (tagged in Fixes).

Fixes: 94a799425e ("From: wlanfae <wlanfae@realtek.com> [PATCH 1/8] rtl8192e: Import new version of driver from realtek")
Cc: stable@vger.kernel.org
Signed-off-by: Atul Gopinathan <atulgopinathan@gmail.com>
Link: https://lore.kernel.org/r/20210323113413.29179-2-atulgopinathan@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-23 13:32:40 +01:00