platform/kernel/linux-starfive.git
20 months agostaging: r8188eu: use subtype helper in rtw_check_bcn_info
Martin Kaiser [Fri, 2 Dec 2022 09:31:59 +0000 (10:31 +0100)]
staging: r8188eu: use subtype helper in rtw_check_bcn_info

Use ieee80211_is_beacon to check the frame subtype in rtw_check_bcn_info.
Replace the call to the driver-specific GetFrameSubType function.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221202093159.404111-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: use subtype helpers in collect_bss_info
Martin Kaiser [Fri, 2 Dec 2022 09:31:58 +0000 (10:31 +0100)]
staging: r8188eu: use subtype helpers in collect_bss_info

Use the iee80211 helper functions to check the frame subtype in
collect_bss_info. Replace the call to the driver-specific
GetFrameSubType function.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221202093159.404111-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: remove unused da parameter
Martin Kaiser [Fri, 2 Dec 2022 09:25:25 +0000 (10:25 +0100)]
staging: r8188eu: remove unused da parameter

All callers of issue_probereq_p2p set the da parameter to NULL. Remove
this parameters and the code that runs only for da != NULL.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221202092525.403887-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: merge two probereq_p2p functions
Martin Kaiser [Fri, 2 Dec 2022 09:25:24 +0000 (10:25 +0100)]
staging: r8188eu: merge two probereq_p2p functions

_issue_probereq_p2p is called only by issue_probereq_p2p. Merge the two
functions and remove the unused return value.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221202092525.403887-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: simplify err handling for unknown station
Martin Kaiser [Tue, 29 Nov 2022 20:51:52 +0000 (21:51 +0100)]
staging: r8188eu: simplify err handling for unknown station

If we receive a disassoc message from an unknown station, we can drop this
message immediately. Reorder the code to make this clearer.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221129205152.128172-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: handle the non-ap case first
Martin Kaiser [Tue, 29 Nov 2022 20:51:51 +0000 (21:51 +0100)]
staging: r8188eu: handle the non-ap case first

The OnDisassoc function hasn't got much to do if we're not working as an
access point. Move this case out of the large if statement to simplify the
code.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221129205152.128172-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: move bBusyTraffic update
Martin Kaiser [Tue, 29 Nov 2022 20:51:50 +0000 (21:51 +0100)]
staging: r8188eu: move bBusyTraffic update

Move the update of bBusyTraffic into the else branch. The if branch ends
with a return statement, so bBusyTraffic will not be updated in this case.

With this change in place, we can reorder the code and save some levels of
indentation.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221129205152.128172-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: read reason code from ieee80211_mgmt
Martin Kaiser [Tue, 29 Nov 2022 20:51:49 +0000 (21:51 +0100)]
staging: r8188eu: read reason code from ieee80211_mgmt

Use the struct ieee80211_mgmt to read the reason code instead of parsing
the message manually.

Remove the pframe pointer, it's no longer used.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221129205152.128172-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: use ieee80211_mgmt to parse addresses
Martin Kaiser [Tue, 29 Nov 2022 20:51:48 +0000 (21:51 +0100)]
staging: r8188eu: use ieee80211_mgmt to parse addresses

Define a struct ieee80211_mgmt in the OnDisassoc function and use it to
parse the addresses in the incoming disassoc message. This replaces some
driver-specific functions for address parsing.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221129205152.128172-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: remove a variable
Martin Kaiser [Sat, 26 Nov 2022 16:01:29 +0000 (17:01 +0100)]
staging: r8188eu: remove a variable

Check the result of rtw_check_bcn_info directly and remove the ret
variable.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126160129.178697-11-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: simplify error handling for missing station
Martin Kaiser [Sat, 26 Nov 2022 16:01:28 +0000 (17:01 +0100)]
staging: r8188eu: simplify error handling for missing station

Simplify the code to handle the case where we're associated to a station
that is not in our list of known stations.

We can simply exit in this case. This patch reverts the if-condition and
saves one level of indentation.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126160129.178697-10-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: stop beacon processing if kmalloc fails
Martin Kaiser [Sat, 26 Nov 2022 16:01:27 +0000 (17:01 +0100)]
staging: r8188eu: stop beacon processing if kmalloc fails

If we cannot allocate a struct wlan_bssid_ex in the OnBeacon function, we
should stop processing the incoming beacon message and return.

For kmalloc failures, the current code just skips the update of network
and beacon info and tries to continue with the authentication. The update
would set the encryption algorithm that should be used for the
authentication.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126160129.178697-9-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: exit if beacon is not from our bss
Martin Kaiser [Sat, 26 Nov 2022 16:01:26 +0000 (17:01 +0100)]
staging: r8188eu: exit if beacon is not from our bss

Do not process an incoming beacon message in the OnBeacon function if the
beacon was sent by a base station other than the one to which we're
connected.

This patch does not modify the behaviour of the code. It reverts the if
condition and returns if the beacon should not be processed. This is
simpler than wrapping the entire processing into a large if clause.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126160129.178697-8-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: simplify update_sta_support_rate params
Martin Kaiser [Sat, 26 Nov 2022 16:01:25 +0000 (17:01 +0100)]
staging: r8188eu: simplify update_sta_support_rate params

The update_sta_support_rate function takes a pointer to information
elements and the total length of all these elements. Use our variables
for pointer and length instead of calculating them manually.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126160129.178697-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: use ie buffer in update_beacon_info
Martin Kaiser [Sat, 26 Nov 2022 16:01:24 +0000 (17:01 +0100)]
staging: r8188eu: use ie buffer in update_beacon_info

The update_beacon_info function parses information elements of a beacon
message. It should take the pointer to the information elements and their
total length, not the entire beacon message.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126160129.178697-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: pass only ies to process_p2p_ps_ie
Martin Kaiser [Sat, 26 Nov 2022 16:01:23 +0000 (17:01 +0100)]
staging: r8188eu: pass only ies to process_p2p_ps_ie

The process_p2p_ps_ie function parses the information elements of a beacon
message and extracts p2p-related info.

process_p2p_ps_ie does not receive a pointer to the information elements
as one would expect. Instead it receives a pointer to the timestamp field
in the beacon message. process_p2p_ps_ie increments this pointer by
_BEACON_IE_OFFSET_ to jump to the start of the information elements (and
decreases the buffer length accordingly).

This is clumsy and hard to understand. Rewrite this such that
process_p2p_ps_ie takes a pointer to the information elements and the
total length of all elements. Check up-front that the total length is
not negative.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126160129.178697-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: replace GetAddr2Ptr calls
Martin Kaiser [Sat, 26 Nov 2022 16:01:22 +0000 (17:01 +0100)]
staging: r8188eu: replace GetAddr2Ptr calls

Get the source address of a beacon frame from our struct ieee80211_mgmt
instead of using the driver's internal GetAddr2Ptr helper.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126160129.178697-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: read timestamp from ieee80211_mgmt
Martin Kaiser [Sat, 26 Nov 2022 16:01:21 +0000 (17:01 +0100)]
staging: r8188eu: read timestamp from ieee80211_mgmt

Read the 64-bit timestamp from struct ieee80211_mgmt instead of parsing
the beacon message ourselves.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126160129.178697-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: replace one GetAddr3Ptr call
Martin Kaiser [Sat, 26 Nov 2022 16:01:20 +0000 (17:01 +0100)]
staging: r8188eu: replace one GetAddr3Ptr call

Define a struct ieee80211_mgmt in the OnBeacon function. Use it to replace
one GetAddr3Ptr call. This is a tiny step towards making GetAddr3Ptr
obsolete.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126160129.178697-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: greybus: loopback_test: Remove extra blank lines
Jack Schofield [Thu, 1 Dec 2022 05:38:52 +0000 (21:38 -0800)]
staging: greybus: loopback_test: Remove extra blank lines

Clean up extra uses of blank lines that do not follow the kernel coding
style. Issue reported by checkpatch.

Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jack Schofield <schofija@oregonstate.edu>
Link: https://lore.kernel.org/r/51edbcc7583d64d3fe5a203d3a8649a695ef4a75.1669872193.git.schofija@oregonstate.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: greybus: loopback_test: Remove void function return statement
Jack Schofield [Thu, 1 Dec 2022 05:38:51 +0000 (21:38 -0800)]
staging: greybus: loopback_test: Remove void function return statement

Void function return statement is not useful in this case. Issue
reported by checkpatch.

Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jack Schofield <schofija@oregonstate.edu>
Link: https://lore.kernel.org/r/5d465d56a6e3de2cb9d2f34377cbb82678cc67b1.1669872193.git.schofija@oregonstate.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: greybus: loopback_test: Add blank line after declaration.
Jack Schofield [Thu, 1 Dec 2022 05:38:50 +0000 (21:38 -0800)]
staging: greybus: loopback_test: Add blank line after declaration.

Declarations are to be followed by a blank line. Add to follow Linux
Kernel coding style. Issue reported by checkpatch.

Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jack Schofield <schofija@oregonstate.edu>
Link: https://lore.kernel.org/r/048967b5c3b157e19ccf4608f71da8418fc31877.1669872193.git.schofija@oregonstate.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: use ieee80211 helper for protected bit
Martin Kaiser [Sat, 26 Nov 2022 15:42:53 +0000 (16:42 +0100)]
staging: r8188eu: use ieee80211 helper for protected bit

Use ieee80211_has_protected to check if the "protected" bit is set. Remove
the r8188eu driver's internal macro for this check.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126154253.178275-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: simplify the checks for zero address
Martin Kaiser [Sat, 26 Nov 2022 15:42:52 +0000 (16:42 +0100)]
staging: r8188eu: simplify the checks for zero address

In function ap2sta_data_frame, we can use is_zero_ether_addr to check for
all-zero ethernet addresses. Both pattrib->bssid and mybssid are 16-bit
aligned.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126154253.178275-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: fix the number of probereq retries
Martin Kaiser [Sat, 26 Nov 2022 15:42:51 +0000 (16:42 +0100)]
staging: r8188eu: fix the number of probereq retries

issue_probereq_ex sends a probe request and retries if this fails. There's
no point in making the number of retries configurable. Hard-code the value
that's used by issue_probereq_ex's only caller.

Simplify the code to check the loop condition only once.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126154253.178275-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: remove wait_ms parameter
Martin Kaiser [Sat, 26 Nov 2022 15:42:50 +0000 (16:42 +0100)]
staging: r8188eu: remove wait_ms parameter

Remove the wait_ms parameter from function issue_probereq_ex. There's only
one caller, who requests a waiting time of 1 ms.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126154253.178275-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: drop return value from issue_probereq_ex
Martin Kaiser [Sat, 26 Nov 2022 15:42:49 +0000 (16:42 +0100)]
staging: r8188eu: drop return value from issue_probereq_ex

The only caller of issue_probereq_ex does not check the return value. We
can remove it and make issue_probereq_ex a void function.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126154253.178275-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: Fix potential use-after-free in rtllib_rx_Monitor()
YueHaibing [Wed, 23 Nov 2022 08:12:53 +0000 (16:12 +0800)]
staging: rtl8192e: Fix potential use-after-free in rtllib_rx_Monitor()

The skb is delivered to netif_rx() in rtllib_monitor_rx(), which may free it,
after calling this, dereferencing skb may trigger use-after-free.
Found by Smatch.

Fixes: 94a799425eee ("From: wlanfae <wlanfae@realtek.com> [PATCH 1/8] rtl8192e: Import new version of driver from realtek")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20221123081253.22296-1-yuehaibing@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: Remove unused variable int_log
Philipp Hortmann [Tue, 22 Nov 2022 22:46:29 +0000 (23:46 +0100)]
staging: rtl8192e: Remove unused variable int_log

int_log is initialized and incremented but never evaluated. Remove
resulting dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/e2edcde052cc3c47e6e6b94d09e460b8cf6a49a8.1669156825.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: Remove unused variable ChannelAccessSetting
Philipp Hortmann [Tue, 22 Nov 2022 22:46:21 +0000 (23:46 +0100)]
staging: rtl8192e: Remove unused variable ChannelAccessSetting

ChannelAccessSetting is never used. Remove resulting dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/b88a31954532f47a4caf9abfcad8e20b32a618cc.1669156825.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: Remove unused variable initialized_at_probe
Philipp Hortmann [Tue, 22 Nov 2022 22:46:15 +0000 (23:46 +0100)]
staging: rtl8192e: Remove unused variable initialized_at_probe

initialized_at_probe is initialized and never used. Remove resulting dead
code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/4855b2dd5b7296b0eb10e697f605fb820e1dfc7b.1669156825.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: Remove unused variable skb_aggQ
Philipp Hortmann [Tue, 22 Nov 2022 22:46:08 +0000 (23:46 +0100)]
staging: rtl8192e: Remove unused variable skb_aggQ

skb_aggQ is initialized, never used and purged. Remove resulting dead
code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/3197be3cb412eea1c662a5bec1b1afda2cee675d.1669156825.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: Remove unchanged variable AcmMethod
Philipp Hortmann [Tue, 22 Nov 2022 22:45:57 +0000 (23:45 +0100)]
staging: rtl8192e: Remove unchanged variable AcmMethod

AcmMethod is initialized and never changed. The evaluation will always
have the same result. Remove resulting dead code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/7d73a66184e13d5f8d4af7d21564032247a7e923.1669156825.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192u: Fix use after free in ieee80211_rx()
Dan Carpenter [Wed, 23 Nov 2022 06:43:14 +0000 (09:43 +0300)]
staging: rtl8192u: Fix use after free in ieee80211_rx()

We cannot dereference the "skb" pointer after calling
ieee80211_monitor_rx(), because it is a use after free.

Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/Y33BArx3k/aw6yv/@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: iio: ade7854: Convert to i2c's .probe_new()
Uwe Kleine-König [Fri, 18 Nov 2022 22:45:02 +0000 (23:45 +0100)]
staging: iio: ade7854: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20221118224540.619276-569-uwe@kleine-koenig.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: olpc_dcon: Convert to i2c's .probe_new()
Uwe Kleine-König [Fri, 18 Nov 2022 22:45:04 +0000 (23:45 +0100)]
staging: olpc_dcon: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20221118224540.619276-571-uwe@kleine-koenig.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: most: i2c: Convert to i2c's .probe_new()
Uwe Kleine-König [Fri, 18 Nov 2022 22:45:03 +0000 (23:45 +0100)]
staging: most: i2c: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20221118224540.619276-570-uwe@kleine-koenig.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agovc04_services: bcm2835-camera: Use bool values for mmal_fmt.remove_padding
Umang Jain [Fri, 18 Nov 2022 08:42:44 +0000 (14:12 +0530)]
vc04_services: bcm2835-camera: Use bool values for mmal_fmt.remove_padding

mmal_fmt.remove_padding is defined as a boolean type hence, use boolean
values for it instead of 0/1 integers. This enhances code readability.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Link: https://lore.kernel.org/r/20221118084244.199909-4-umang.jain@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agovc04_services: mmal-vchiq: Use bool for vchiq_mmal_component.in_use
Umang Jain [Fri, 18 Nov 2022 08:42:43 +0000 (14:12 +0530)]
vc04_services: mmal-vchiq: Use bool for vchiq_mmal_component.in_use

In commit 7967656ffbfa ("coding-style: Clarify the expectations around
bool") the check to dis-allow bool structure members was removed from
checkpatch.pl. It promotes bool structure members to store boolean
values. This enhances code readability.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://lore.kernel.org/r/20221118084244.199909-3-umang.jain@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agoRevert "staging: mmal-vchiq: Avoid use of bool in structures"
Umang Jain [Fri, 18 Nov 2022 08:42:42 +0000 (14:12 +0530)]
Revert "staging: mmal-vchiq: Avoid use of bool in structures"

This reverts commit 640e77466e69d9c28de227bc76881f5501f532ca.

In commit 7967656ffbfa ("coding-style: Clarify the expectations around
bool") the check to dis-allow bool structure members was removed from
checkpatch.pl. It promotes bool structure members to store boolean
values. This enhances code readability.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Link: https://lore.kernel.org/r/20221118084244.199909-2-umang.jain@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: gdm724x: Replace macro GDM_TTY_READY with static inline function
Brent Pappas [Thu, 17 Nov 2022 19:54:43 +0000 (14:54 -0500)]
staging: gdm724x: Replace macro GDM_TTY_READY with static inline function

Replace the macro GDM_TTY_READY with a static inline function
to follow the Linux kernel coding style.

Signed-off-by: Brent Pappas <bpappas@pappasbrent.com>
Link: https://lore.kernel.org/r/20221117195443.19616-1-bpappas@pappasbrent.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: vme_user: Fix possible UAF in tsi148_dma_list_add
Gaosheng Cui [Thu, 17 Nov 2022 03:59:14 +0000 (11:59 +0800)]
staging: vme_user: Fix possible UAF in tsi148_dma_list_add

Smatch report warning as follows:

drivers/staging/vme_user/vme_tsi148.c:1757 tsi148_dma_list_add() warn:
  '&entry->list' not removed from list

In tsi148_dma_list_add(), the error path "goto err_dma" will not
remove entry->list from list->entries, but entry will be freed,
then list traversal may cause UAF.

Fix by removeing it from list->entries before free().

Fixes: b2383c90a9d6 ("vme: tsi148: fix first DMA item mapping")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Link: https://lore.kernel.org/r/20221117035914.2954454-1-cuigaosheng1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192e: Rename pHTInfo
Philipp Hortmann [Sun, 13 Nov 2022 04:36:15 +0000 (05:36 +0100)]
staging: rtl8192e: Rename pHTInfo

Rename variable pHTInfo to ht_info to avoid CamelCase which is not
accepted by checkpatch.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/88cdc0ef393c92cb2102a66893c5320e8c8606df.1668313325.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192e: Rename InterruptLog, RxCounter and bHwRfOffAction
Philipp Hortmann [Sun, 13 Nov 2022 04:36:09 +0000 (05:36 +0100)]
staging: rtl8192e: Rename InterruptLog, RxCounter and bHwRfOffAction

Rename variable InterruptLog to int_log, RxCounter to rx_ctr and
bHwRfOffAction to hw_rf_off_action to avoid CamelCase which is not
accepted by checkpatch.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/82ea07ddd894ac9b863ce90ddb9ba78065bd1f4e.1668313325.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192e: Rename bFilterSour.., CCKPresentAt.. and ResetProg..
Philipp Hortmann [Sun, 13 Nov 2022 04:36:02 +0000 (05:36 +0100)]
staging: rtl8192e: Rename bFilterSour.., CCKPresentAt.. and ResetProg..

Rename variable bFilterSourceStationFrame to fltr_src_sta_frame,
CCKPresentAttentuation to cck_present_attn and ResetProgress to
rst_progress to avoid CamelCase which is not accepted by checkpatch.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/25ab52350a4a3249a1f76b28eea10c44e2f9552d.1668313325.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192e: Rename bNetPromisc.., IntelPromiscu.. and bPromiscu..
Philipp Hortmann [Sun, 13 Nov 2022 04:35:55 +0000 (05:35 +0100)]
staging: rtl8192e: Rename bNetPromisc.., IntelPromiscu.. and bPromiscu..

Rename variable bNetPromiscuousMode to net_promiscuous_md,
IntelPromiscuousModeInfo to intel_promiscuous_md_info and bPromiscuousOn
to promiscuous_on to avoid CamelCase which is not accepted by checkpatch.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/69d9998a30ce2286c3ae6cb4510174e1255b3f9e.1668313325.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192e: Rename LinkDetectInfo
Philipp Hortmann [Sun, 13 Nov 2022 04:35:49 +0000 (05:35 +0100)]
staging: rtl8192e: Rename LinkDetectInfo

Rename variable LinkDetectInfo to link_detect_info to avoid CamelCase
which is not accepted by checkpatch.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/48d043893fa755490e810af204e5b7ad2ba606de.1668313325.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192e: Rename RFInProgres.., bEnableHT and RegChannelPlan
Philipp Hortmann [Sun, 13 Nov 2022 04:35:43 +0000 (05:35 +0100)]
staging: rtl8192e: Rename RFInProgres.., bEnableHT and RegChannelPlan

Rename variable RFInProgressTimeOut to rf_in_progress_timeout, bEnableHT
to enable_ht and RegChannelPlan to reg_chnl_plan to avoid CamelCase which
is not accepted by checkpatch.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/aa3b8fd4a51fc9b1c32566cd079590bf11a9190d.1668313325.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192e: Rename pPSC
Philipp Hortmann [Sun, 13 Nov 2022 04:35:34 +0000 (05:35 +0100)]
staging: rtl8192e: Rename pPSC

Rename variable pPSC to psc to avoid CamelCase which is not accepted by
checkpatch.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/47ded8a906e55d6f09b51cd8f2dfb78b7b92c1cc.1668313325.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192e: Rename Regdot11TxHT.., dot11HTOpera.. and RegHTSuppRa..
Philipp Hortmann [Sun, 13 Nov 2022 04:35:27 +0000 (05:35 +0100)]
staging: rtl8192e: Rename Regdot11TxHT.., dot11HTOpera.. and RegHTSuppRa..

Rename variable Regdot11TxHTOperationalRateSet to
reg_dot11tx_ht_oper_rate_set, dot11HTOperationalRateSet to
dot11ht_oper_rate_set and RegHTSuppRateSet to reg_ht_supp_rate_set to
avoid CamelCase which is not accepted by checkpatch.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/0c87e7ffc94be1c26f6400f5e12419f2df0418a3.1668313325.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192e: Rename Regdot11HTOper.., bSupportM.. and PowerSaveCo..
Philipp Hortmann [Sun, 13 Nov 2022 04:35:12 +0000 (05:35 +0100)]
staging: rtl8192e: Rename Regdot11HTOper.., bSupportM.. and PowerSaveCo..

Rename variable Regdot11HTOperationalRateSet to
reg_dot11ht_oper_rate_set, bSupportMode to support_mode and
PowerSaveControl to pwr_save_ctrl to avoid CamelCase which is not accepted
by checkpatch. Fix unnecessary parentheses warning from checkpatch when
used with this variables.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/1ef7fd22b4a037c4d1f8685065ce7916b6f0930b.1668313325.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192e: Rename bTxDisableRate.., RegMaxLPSAwa.. and bTxUseD..
Philipp Hortmann [Sun, 13 Nov 2022 04:34:54 +0000 (05:34 +0100)]
staging: rtl8192e: Rename bTxDisableRate.., RegMaxLPSAwa.. and bTxUseD..

Rename variable bTxDisableRateFallBack to tx_dis_rate_fallback,
RegMaxLPSAwakeIntvl to reg_max_lps_awake_intvl and
bTxUseDriverAssingedRate to tx_use_drv_assinged_rate to avoid CamelCase
which is not accepted by checkpatch.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/092eb2dc73d37daf851ea9ef9cb7e4df6f766845.1668313325.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: binstallGrpkey is set to _FAIL
Michael Straube [Fri, 11 Nov 2022 08:37:33 +0000 (09:37 +0100)]
staging: r8188eu: binstallGrpkey is set to _FAIL

The variable binstallGrpkey is set to _FAIL which is defined as 0.
Use false to set the variable to get rid of another use of _FAIL.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20221111083733.3144-5-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: convert _rtw_init_xmit_priv() to common error logic
Michael Straube [Fri, 11 Nov 2022 08:37:32 +0000 (09:37 +0100)]
staging: r8188eu: convert _rtw_init_xmit_priv() to common error logic

Convert the function _rtw_init_xmit_priv() away from returning _FAIL
or _SUCCESS which uses inverted error logic. Use the common error
logic instead. Return 0 for success and negative values for failure.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20221111083733.3144-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: convert rtw_xmit_resource_alloc() to common error logic
Michael Straube [Fri, 11 Nov 2022 08:37:31 +0000 (09:37 +0100)]
staging: r8188eu: convert rtw_xmit_resource_alloc() to common error logic

Convert the function rtw_xmit_resource_alloc() away from returning
_FAIL or _SUCCESS which uses inverted error logic. Use the common
error logic instead. Return 0 for success and negative values for
failure.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20221111083733.3144-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: convert aes_cipher() to void
Michael Straube [Fri, 11 Nov 2022 08:37:30 +0000 (09:37 +0100)]
staging: r8188eu: convert aes_cipher() to void

The function aes_cipher() returns always _SUCCESS and its callers
do not use the return value. So we can convert the return type to
void and get rid of another use of _SUCCESS.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20221111083733.3144-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: rename three functions
Michael Straube [Thu, 10 Nov 2022 09:09:27 +0000 (10:09 +0100)]
staging: r8188eu: rename three functions

Prefix the names of the following functions with the driver name. The
original names are bad for the global namespace. While at it, convert
is_IBSS_empty() to all lower case to follow kernel coding style.

is_client_associated_to_ap()
is_client_associated_to_ibss()
is_IBSS_empty()

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20221110090927.17274-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192u: remove redundant macro definitions
Deepak R Varma [Tue, 8 Nov 2022 18:09:56 +0000 (23:39 +0530)]
staging: rtl8192u: remove redundant macro definitions

Several ieee80211_* symbol names are extended with _rsl tag using
macros. This is done to avoid a conflict when a similar symbol is
already in use in another part of kernel and may lead to conflicts.
However, most of these base symbol names are not found to being used
anywhere in the code and hence are not useful today. These symbols
are not used outside of the module and hence can be safely removed.
The code continues to use the original symbol names.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/17f69a042e215c484931a0327fdf7775eea5f918.1667930292.git.drv@mailo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: fieldbus: use sysfs_emit() in show functions
Deepak R Varma [Wed, 9 Nov 2022 10:42:43 +0000 (16:12 +0530)]
staging: fieldbus: use sysfs_emit() in show functions

The show() methods should only use sysfs_emit() when formatting values
to be returned to the user space.
Ref: Documentation/filesystems/sysfs.rst
Issue identified by coccicheck.

Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/Y2uEIzebbM/Fs5Jz@qemulion
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: ks7010: Avoid clashing function prototypes
Gustavo A. R. Silva [Tue, 8 Nov 2022 20:34:46 +0000 (14:34 -0600)]
staging: ks7010: Avoid clashing function prototypes

When built with Control Flow Integrity, function prototypes between
caller and function declaration must match. These mismatches are visible
at compile time with the new -Wcast-function-type-strict in Clang[1].

Fix a total of 27 warnings like these:

drivers/staging/ks7010/ks_wlan_net.c:2415:2: warning: cast from 'int (*)(struct net_device *, struct iw_request_info *, struct iw_point *, char *)' to 'iw_handler' (aka 'int (*)(struct net_device *, struct iw_request_info *, union iwreq_data *, char *)') converts to incompatible function type [-Wcast-function-type-strict]
        (iw_handler)ks_wlan_get_firmware_version,/* 3 KS_WLAN_GET_FIRM_VERSION */
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ks_wlan_net Wireless Extension handler callbacks (iw_handler) use a
union for the data argument. Actually use the union and perform explicit
member selection in the function body instead of having a function
prototype mismatch. There are no resulting binary differences
before/after changes.

These changes were made partly manually and partly with the help of
Coccinelle.

Link: https://reviews.llvm.org/D134831
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/8d2ceee1248b5a76e9b6c379f578e65482c91168.1667934775.git.gustavoars@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agodrivers: staging: r8188eu: Fix sleep-in-atomic-context bug in rtw_join_timeout_handler
Duoming Zhou [Tue, 18 Oct 2022 08:34:24 +0000 (16:34 +0800)]
drivers: staging: r8188eu: Fix sleep-in-atomic-context bug in rtw_join_timeout_handler

The rtw_join_timeout_handler() is a timer handler that
runs in atomic context, but it could call msleep().
As a result, the sleep-in-atomic-context bug will happen.
The process is shown below:

     (atomic context)
rtw_join_timeout_handler
 _rtw_join_timeout_handler
  rtw_do_join
   rtw_select_and_join_from_scanned_queue
    rtw_indicate_disconnect
     rtw_lps_ctrl_wk_cmd
      lps_ctrl_wk_hdl
       LPS_Leave
        LPS_RF_ON_check
         msleep //sleep in atomic context

Fix by removing msleep() and replacing with mdelay().

Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20221018083424.79741-1-duoming@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: drop removal/stop check in dump_mgntframe_and_wait_ack
Martin Kaiser [Mon, 7 Nov 2022 20:28:24 +0000 (21:28 +0100)]
staging: r8188eu: drop removal/stop check in dump_mgntframe_and_wait_ack

We can remove the checks for bDriverStopped and bSurpriseRemoved in
dump_mgntframe_and_wait_ack.

The code path from this function looks like

dump_mgntframe_and_wait_ack
   rtl8188eu_mgnt_xmit
      rtw_dump_xframe
         loop over all fragments

rtw_write_port is called for each fragment. bSurpriseRemoved and
bDriverStopped are checked in rtw_write_port.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221107202824.61431-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: drop another removal/stop check
Martin Kaiser [Mon, 7 Nov 2022 20:28:23 +0000 (21:28 +0100)]
staging: r8188eu: drop another removal/stop check

There's no need to check bDriverStopped and bSurpriseRemoved in
issue_probereq_ex.

The code path looks like

issue_probereq_ex
   _issue_probereq
      dump_mgntframe
      or
      dump_mgntframe_and_wait_ack

All paths from dump_mgntframe check the two variables.
dump_mgntframe_and_wait_ack contains a check as well.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221107202824.61431-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: use a qos_hdr in validate_recv_data_frame
Martin Kaiser [Mon, 7 Nov 2022 20:28:22 +0000 (21:28 +0100)]
staging: r8188eu: use a qos_hdr in validate_recv_data_frame

Define a struct ieee80211_qos_hdr in the validate_recv_data_frame
function. Use this struct to replace some numeric offsets and make the
code easier to understand.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221107202824.61431-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: remove unnecessary casting
Deepak R Varma [Sun, 6 Nov 2022 17:57:12 +0000 (23:27 +0530)]
staging: r8188eu: remove unnecessary casting

The dhcpMessage struct member variable "cookie" is already declared
to be of type __be32. There is no need to cast it again as __be32.

Signed-off-by: Deepak R Varma <drv@mailo.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/c333e22349c5c347c740b425330b35830b969fa9.1667755987.git.drv@mailo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: simplify complex pointer casting
Deepak R Varma [Sun, 6 Nov 2022 17:55:37 +0000 (23:25 +0530)]
staging: r8188eu: simplify complex pointer casting

Pointers to structures udphdr and dhcpMessage are derived by casting
adjacent pointers with size_t. Such typecast of pointer using size_t
is not preferred. The code looks complex and delicate. Simplify such
casting by utilizing generic "void *" casting.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/1428580d09a9916899209c9278dca40ee2d297d3.1667755987.git.drv@mailo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: clean up error handling in rtw_start_drv_threads()
Michael Straube [Sun, 6 Nov 2022 13:34:43 +0000 (14:34 +0100)]
staging: r8188eu: clean up error handling in rtw_start_drv_threads()

Convert the error handling in the function rtw_start_drv_threads() to
the common logic used in the kernel. Another step to get rid of _FAIL
and _SUCCESS which uses inverted logic.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20221106133443.8872-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: remove checks in dump_mgntframe
Martin Kaiser [Sun, 6 Nov 2022 12:49:01 +0000 (13:49 +0100)]
staging: r8188eu: remove checks in dump_mgntframe

There's no need to check for bSurpriseRemoved and bDriverStopped in
dump_mgmtframe.

The sequence of function calls is

dump_mgntframe
   rtl8188eu_mgnt_xmit
      rtw_dump_xframe
         loop over all fragments

For each fragment, rtw_write_port is called. This function checks
bSurpriseRemoved and bDriverStopped.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20221106124901.720785-10-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: merge two rtw_free_network_nolock functions
Martin Kaiser [Sun, 6 Nov 2022 12:49:00 +0000 (13:49 +0100)]
staging: r8188eu: merge two rtw_free_network_nolock functions

Remove the _rtw_free_network_nolock function and merge it into
rtw_free_network_nolock, which is its only caller.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20221106124901.720785-9-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: remove get_fwstate
Martin Kaiser [Sun, 6 Nov 2022 12:48:59 +0000 (13:48 +0100)]
staging: r8188eu: remove get_fwstate

The get_fwstate function is not used. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20221106124901.720785-8-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: clean up rtw_hal_init
Martin Kaiser [Sun, 6 Nov 2022 12:48:58 +0000 (13:48 +0100)]
staging: r8188eu: clean up rtw_hal_init

Clean up the rtw_hal_init function.

Remove the status variable. Exit immediately for errors.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20221106124901.720785-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: remove state checks in rtw_led_control
Martin Kaiser [Sun, 6 Nov 2022 12:48:57 +0000 (13:48 +0100)]
staging: r8188eu: remove state checks in rtw_led_control

There's no need to check for bSurpriseRemoved or bDriverStopped in the
rtw_led_control function. This function schedules a delayed worker which
calls SwLedOn or SwLedOff (or the function calls SwLedOff directly).

SwLedOn and SwLedOff check bDriverStopped themselves or they initiate a
USB control transfer via usb_write, where bSurpriseRemoved is checked.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20221106124901.720785-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: reformat a function header
Martin Kaiser [Sun, 6 Nov 2022 12:48:56 +0000 (13:48 +0100)]
staging: r8188eu: reformat a function header

The definition of Hal_EfuseParseIDCode88E can be a single line.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20221106124901.720785-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: reorder assignments, clarify the header format
Martin Kaiser [Sun, 6 Nov 2022 12:48:55 +0000 (13:48 +0100)]
staging: r8188eu: reorder assignments, clarify the header format

Reorder some of the assignments in update_recvframe_attrib_88e.

This should make it a bit easier to understand the format of the header
that is added by the chip's firmware.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20221106124901.720785-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: remove some obsolete comments
Martin Kaiser [Sun, 6 Nov 2022 12:48:54 +0000 (13:48 +0100)]
staging: r8188eu: remove some obsolete comments

Remove obsolete comments in validate_recv_data_frame.
There is no prxcmd variable (any more?).

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20221106124901.720785-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: don't store addba request
Martin Kaiser [Sun, 6 Nov 2022 12:48:53 +0000 (13:48 +0100)]
staging: r8188eu: don't store addba request

There's no need to store an incoming addba request in struct
mlme_ext_info. We only need the addba request to copy some of its fields
into our addba response.

It's simpler to pass the incoming request's management frame to
issue_action_BA as an additional parameter. issue_action_BA can then
extract the required fields. If issue_action_BA prepares a request rather
than a response, the caller sets the parameter for the incoming request to
NULL.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20221106124901.720785-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: convert three functions to bool
Michael Straube [Sat, 5 Nov 2022 09:39:16 +0000 (10:39 +0100)]
staging: r8188eu: convert three functions to bool

The functions

is_client_associated_to_ap()
is_client_associated_to_ibss()
is_IBSS_empty()

return boolean values. Convert their return type to bool and replace
_FAIL, which is defined as 0, with false. Another step to get rid of
_SUCCESS / _FAIL.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20221105093916.8255-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: remove unused struct declarations
Deepak R Varma [Wed, 2 Nov 2022 20:53:18 +0000 (02:23 +0530)]
staging: r8188eu: remove unused struct declarations

Some structures are only declared but have not been used anywhere
in the code. Remove such unused structs. Issue identified as part
of coccicheck report driven code investigation.

Suggested-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/Y2LYvhr74ng+xFbz@qemulion
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: emxx_udc: use min helper macro for variable comparison
Deepak R Varma [Sun, 6 Nov 2022 10:21:58 +0000 (15:51 +0530)]
staging: emxx_udc: use min helper macro for variable comparison

Simplify code by using min helper macros in place of lengthy if/else
block oriented logical evaluation and value assignment. This issue is
identified by coccicheck using the minmax.cocci file.

Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/Y2eKxoUWtbPY/88b@qemulion
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8723bs: replace underutilized struct by array variable
Deepak R Varma [Sat, 5 Nov 2022 11:15:52 +0000 (16:45 +0530)]
staging: rtl8723bs: replace underutilized struct by array variable

For structure iqk_matrix_regs_setting, only the "Value" member variable
is utilized whereas the other struct members are only declared but not
utilised. Replace the struct declaration and implementation by an
equivalent variable similar to the only used struct member variable.
While in there, update the macro mixed case names to uppercase style.
The resultant code is simpler and is easy to maintain.

Suggested-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/Y2ZF6O1KU3zZ6r3C@qemulion
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192e: Fix divide fault when calculating beacon age
Larry Finger [Fri, 4 Nov 2022 01:27:50 +0000 (20:27 -0500)]
staging: rtl8192e: Fix divide fault when calculating beacon age

When the configuration parameter CONFIG_HZ is less that 100, the compiler
generates an error as follows:

../drivers/staging/rtl8192e/rtllib_wx.c: In function 'rtl819x_translate_scan':
../drivers/staging/rtl8192e/rtllib_wx.c:220:57: warning: division by zero [-Wdiv-by-zero]
  220 |      (jiffies - network->last_scanned) / (HZ / 100));
      |                                                         ^
In file included from ../include/linux/skbuff.h:45,
                 from ../include/linux/if_ether.h:19,
                 from ../include/linux/etherdevice.h:20,
                 from ../drivers/staging/rtl8192e/rtllib_wx.c:18:
../drivers/staging/rtl8192e/rtllib_wx.c: In function 'rtllib_wx_get_scan':
../drivers/staging/rtl8192e/rtllib_wx.c:261:70: warning: division by zero [-Wdiv-by-zero]
  261 |      (jiffies - network->last_scanned) /
      |

In fact, is HZ is not a multiple of 100, the calculation will be wrong,
but it will compile correctly.

The fix is to get rid of the (HZ / 100) portion. To decrease any round-off
errors, the compiler is forced to perform the 100 * jiffies-difference
before dividing by HZ. This patch is only compile tested.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/20221104012750.2076-1-Larry.Finger@lwfinger.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: change return type of rtw_set_802_11_disassociate to void
Phillip Potter [Thu, 3 Nov 2022 23:06:32 +0000 (23:06 +0000)]
staging: r8188eu: change return type of rtw_set_802_11_disassociate to void

Change return type of rtw_set_802_11_disassociate to void. This function
always returns 'true' no matter what, so there is no need to return a
value, and no need to check for it in the two call sites within
rtw_wx_set_mlme. Also, as we are no longer using ret in rtw_wx_set_mlme
except as the return value, just remove it and return 0 directly.

Suggested-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20221103230632.6946-1-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192e: rtl819x_HTProc: make arrays const and one static
Colin Ian King [Thu, 3 Nov 2022 13:06:19 +0000 (13:06 +0000)]
staging: rtl8192e: rtl819x_HTProc: make arrays const and one static

Make two dead-only arrays const. Make array EWC11NHTCap static const
so it is not populated on the stack, makes the code smaller too.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/20221103130619.78413-1-colin.i.king@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: remove unused ijk_matrix_regs_set implementation
Deepak R Varma [Thu, 3 Nov 2022 17:28:06 +0000 (22:58 +0530)]
staging: r8188eu: remove unused ijk_matrix_regs_set implementation

Instance IQKMatrixRegSetting of struct ijk_matrix_regs_set is
initialised and its member variables are assigned values, but it is
not used anywhere. Remove the structure and its unused implementation.

Suggested-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/Y2P6Jj+IcPss0wFd@qemulion
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8723bs: Use min/max macros for variable comparison
Deepak R Varma [Thu, 3 Nov 2022 09:33:29 +0000 (15:03 +0530)]
staging: rtl8723bs: Use min/max macros for variable comparison

Simplify code by using min and max helper macros in place of lengthy
if/else block oriented logical evaluation and value assignment. This
issue is identified by coccicheck using the minmax.cocci file.

Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/Y2OK6fcIkH3S2/1f@qemulion
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192e: Use min_t/max_t macros for variable comparison
Deepak R Varma [Wed, 2 Nov 2022 22:36:59 +0000 (04:06 +0530)]
staging: rtl8192e: Use min_t/max_t macros for variable comparison

Simplify code by using min_t and max_t helper macros in place of lengthy
if/else block oriented logical evaluation and value assignment. This
issue is identified by coccicheck using the minmax.cocci file.

Use the *_t variants of min/max macros to avoid compiler warnings about
data typecast.
Also, use u32 as type for min_t macro to avoid any truncation of data
associated with enum constant HT_AGG_SIZE_32K.

Signed-off-by: Deepak R Varma <drv@mailo.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/Y2LxC2kziM1TznhO@qemulion
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: vt6655: change 2 variable names wFB_Opt0 and wFB_Opt1
Tanjuate Brunostar [Thu, 3 Nov 2022 07:34:22 +0000 (07:34 +0000)]
staging: vt6655: change 2 variable names wFB_Opt0 and wFB_Opt1

These variables are named using Hungarian notation, which is not used
in the Linux kernel.

Signed-off-by: Tanjuate Brunostar <tanjubrunostar0@gmail.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/Y2Nu/i957Ill7r+d@elroy-temp-vm.gaiao0uenmiufjlowqgp5yxwdh.gvxx.internal.cloudapp.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: convert rtw_setdatarate_cmd to correct error semantics
Phillip Potter [Wed, 2 Nov 2022 00:36:13 +0000 (00:36 +0000)]
staging: r8188eu: convert rtw_setdatarate_cmd to correct error semantics

Convert rtw_setdatarate_cmd function to use proper error return codes
rather than _SUCCESS and _FAIL, and a simpler 'return 0;' style. For now,
wrap rtw_enqueue_cmd call and return -EPERM if it fails, as converting
this function makes more sense later on due to its large number of callers.

Also change rtw_wx_set_rate function to pass through the proper error
code rather than just 0 or -1.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20221102003613.971-1-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: wlan-ng: Remove unused structure definitions
Deepak R Varma [Tue, 1 Nov 2022 13:50:40 +0000 (19:20 +0530)]
staging: wlan-ng: Remove unused structure definitions

Remove structure definitions that are never used in the code.

Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/74a79ea400ec26624e445692f3353424fb6fc29e.1667308828.git.drv@mailo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: wlan-ng: Remove unused function declarations
Deepak R Varma [Tue, 1 Nov 2022 13:50:13 +0000 (19:20 +0530)]
staging: wlan-ng: Remove unused function declarations

Several functions are declared but are not implemented or used in any
part of the code. Remove such unimplemented function declarations.

Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/09e2af8d702e33c15ed9f655b0a1190b4e8bec86.1667308828.git.drv@mailo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: wlan-ng: Remove unused struct p80211macarray definition
Deepak R Varma [Tue, 1 Nov 2022 13:49:54 +0000 (19:19 +0530)]
staging: wlan-ng: Remove unused struct p80211macarray definition

struct p80211macarray is defined but is never used. Remove the unused
struct declaration.
Issue identified as part of coccicheck based code analysis.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/b42eff9b8f73542bc9015948e5e4684416982e1b.1667308828.git.drv@mailo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: wlan-ng: Remove unused struct wlan_ie_ibss_parms references
Deepak R Varma [Tue, 1 Nov 2022 13:49:30 +0000 (19:19 +0530)]
staging: wlan-ng: Remove unused struct wlan_ie_ibss_parms references

Pointer reference to struct wlan_ie_ibss_parms is added as a member
variable to 2 structures; However, these references are never used.
Remove such unused struct references. The cleanup also renders the
struct useless; so remove it as well.
Issue identified as part of coccicheck based code analysis.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/e53084cdd3ca3ffea6a32393f6f28c7b7650d1a4.1667308828.git.drv@mailo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: wlan-ng: Remove unused struct wlan_ie_tim references
Deepak R Varma [Tue, 1 Nov 2022 13:49:05 +0000 (19:19 +0530)]
staging: wlan-ng: Remove unused struct wlan_ie_tim references

Pointer reference to struct wlan_ie_tim is added as a member
variable of a structure; However, this references is never
used. Remove such unused struct reference. The cleanup also
renders the struct useless; so remove it as well.
Issue identified as part of coccicheck based code analysis.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/36834007587a2e0ef7a782f5919f3a4c756b7840.1667308828.git.drv@mailo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: wlan-ng: Remove unused struct wlan_ie_supp_rates references
Deepak R Varma [Tue, 1 Nov 2022 13:48:35 +0000 (19:18 +0530)]
staging: wlan-ng: Remove unused struct wlan_ie_supp_rates references

Pointer reference to struct wlan_ie_supp_rates is added as a member
variable to 7 different structures. However, these references are
never used. Remove such unused struct references. The cleanup also
renders the struct useless; so remove it as well.
Issue identified as part of coccicheck based code analysis.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/370feb1f300896af66fa1c443d3ad19dc8934be3.1667308828.git.drv@mailo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: wlan-ng: Remove unused struct wlan_ie_ssid references
Deepak R Varma [Tue, 1 Nov 2022 13:48:10 +0000 (19:18 +0530)]
staging: wlan-ng: Remove unused struct wlan_ie_ssid references

Pointer reference to struct wlan_ie_ssid is added as a member variable
to 5 different structures. However, these references are never used.
Remove such unused struct references. The cleanup also renders the
struct useless; so remove it as well.
Issue identified as part of coccicheck based code analysis.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/6e39ef59d01d65a1e179f6aecfbb0d68b81fa257.1667308828.git.drv@mailo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: convert rtw_free_stainfo() to void
Michael Straube [Tue, 1 Nov 2022 19:14:58 +0000 (20:14 +0100)]
staging: r8188eu: convert rtw_free_stainfo() to void

The function rtw_free_stainfo() returns always _SUCCESS and none of
its callers uses the return value. We can safely make the function
void. Yet another tiny step towards getting rid of _FAIL / _SUCCESS.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20221101191458.8619-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: r8188eu: remove extern from function prototypes
Michael Straube [Tue, 1 Nov 2022 19:14:57 +0000 (20:14 +0100)]
staging: r8188eu: remove extern from function prototypes

Declaring function prototypes extern is redundant and triggers
checkpatch warnings. Remove all extern from function prototypes.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20221101191458.8619-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192u: remove unnecessary function implementation
Deepak R Varma [Mon, 31 Oct 2022 17:55:39 +0000 (23:25 +0530)]
staging: rtl8192u: remove unnecessary function implementation

This driver is a single standalone driver and does not have any loading
dependencies on another associated drivers. The build results in one
single .ko object. The current implementation of the function
ieee80211_tkip_null simply returns back to the caller without any useful
instruction executions. It does not lead to auto-loading of any other
associated modules as the initial design implementation appears to be.

Hence the call to ieee80211_tkip_null() and its implementation is
unnecessary and should be removed.

Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/6f5a4313fc21365bf733c25385aef79554ffb253.1667237959.git.drv@mailo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: rtl8192e: Remove line breaks to match coding style
Gabhyun Kim [Tue, 1 Nov 2022 06:26:36 +0000 (15:26 +0900)]
staging: rtl8192e: Remove line breaks to match coding style

Remove redundant line break in function definition to
correct coding style.

Signed-off-by: Gabhyun Kim <kimgaby415@gmail.com>
Link: https://lore.kernel.org/r/20221101062636.GA3257@ubuntu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 months agostaging: octeon: cvmx_ptr_to_phys() should return physaddr_t
Geert Uytterhoeven [Tue, 1 Nov 2022 08:01:11 +0000 (09:01 +0100)]
staging: octeon: cvmx_ptr_to_phys() should return physaddr_t

On 32-bit without physical address extensions (e.g. sh-allmodconfig):

    drivers/staging/octeon/ethernet-mem.c: In function ‘cvm_oct_free_hw_memory’:
    ./arch/sh/include/asm/io.h:239:32: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
      239 | #define phys_to_virt(address) ((void *)(address))
  |                                ^
    drivers/staging/octeon/ethernet-mem.c:123:18: note: in expansion of macro ‘phys_to_virt’
      123 |    fpa = (char *)phys_to_virt(cvmx_ptr_to_phys(fpa));
  |                  ^~~~~~~~~~~~

Fix this by making cvmx_ptr_to_phys() return physaddr_t instead of
uint64_t.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/20221101080111.750748-1-geert@linux-m68k.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>