platform/kernel/linux-rpi.git
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 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>
20 months agostaging: vt6655: change variable name wTimeStampOff
Tanjuate Brunostar [Tue, 1 Nov 2022 09:55:33 +0000 (09:55 +0000)]
staging: vt6655: change variable name wTimeStampOff

Remove the use of Hungarian notation, which is not used in the Linux
kernel.

Signed-off-by: Tanjuate Brunostar <tanjubrunostar0@gmail.com>
Link: https://lore.kernel.org/r/Y2DtFRdhCiyNF2kF@elroy-temp-vm.gaiao0uenmiufjlowqgp5yxwdh.gvxx.internal.cloudapp.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: use ether_addr_equal in OnAction
Martin Kaiser [Mon, 31 Oct 2022 20:51:41 +0000 (21:51 +0100)]
staging: r8188eu: use ether_addr_equal in OnAction

Use ether_addr_equal to compare two mac addresses in OnAction.

Both struct ieee80211_mgmt and struct eeprom_priv's mac_addr component
are 2-byte aligned.

Suggested-by: Joe Perches <joe@perches.com>
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/20221031205140.124682-1-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: replace ternary operator with min, max, abs macros
Michael Straube [Mon, 31 Oct 2022 15:37:43 +0000 (16:37 +0100)]
staging: r8188eu: replace ternary operator with min, max, abs macros

Replace some ternary operators with the min(), max() or abs() macros
to improve readability.

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/20221031153743.8801-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: use ieee80211_get_SA
Martin Kaiser [Mon, 31 Oct 2022 20:54:12 +0000 (21:54 +0100)]
staging: r8188eu: use ieee80211_get_SA

Use ieee80211_get_SA in update_recvframe_phyinfo_88e instead of the
driver-specific get_sa 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/20221031205412.124871-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: use hdr->frame_control instead of fc
Martin Kaiser [Mon, 31 Oct 2022 20:54:11 +0000 (21:54 +0100)]
staging: r8188eu: use hdr->frame_control instead of fc

We can remove the fc variable in update_recvframe_phyinfo_88e and use
hdr->frame_control instead.

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/20221031205412.124871-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: use ether_addr_equal for address comparison
Martin Kaiser [Mon, 31 Oct 2022 20:54:10 +0000 (21:54 +0100)]
staging: r8188eu: use ether_addr_equal for address comparison

We can use ether_addr_equal instead of memcmp in
update_recvframe_phyinfo_88e for comparing the incoming frame's
destination address with our local address.

Both struct ieee80211_hdr and struct eeprom_priv's mac_addr component are
2-byte aligned.

Suggested-by: Joe Perches <joe@perches.com>
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/20221031205412.124871-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: check destination address in OnAction
Martin Kaiser [Sun, 30 Oct 2022 17:33:26 +0000 (18:33 +0100)]
staging: r8188eu: check destination address in OnAction

All subfunctions of OnAction check if the destination address matches the
local interface's address. It's simpler to move this check to OnAction.

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/20221030173326.1588647-14-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: rtw_action_public_decache's token is a u8
Martin Kaiser [Sun, 30 Oct 2022 17:33:25 +0000 (18:33 +0100)]
staging: r8188eu: rtw_action_public_decache's token is a u8

Both callers of rtw_action_public_decache pass a u8 value for the token
parameter. We can change token from s32 to u8 and remove the code for
token < 0.

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/20221030173326.1588647-13-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: remove return value from on_action_public_default
Martin Kaiser [Sun, 30 Oct 2022 17:33:24 +0000 (18:33 +0100)]
staging: r8188eu: remove return value from on_action_public_default

The only caller of on_action_public_default does not check the return
value. We can make it 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/20221030173326.1588647-12-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: remove return value from on_action_public_vendor
Martin Kaiser [Sun, 30 Oct 2022 17:33:23 +0000 (18:33 +0100)]
staging: r8188eu: remove return value from on_action_public_vendor

The only caller of on_action_public_vendor does not check the return
value. We can make it 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/20221030173326.1588647-11-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: clean up on_action_public
Martin Kaiser [Sun, 30 Oct 2022 17:33:22 +0000 (18:33 +0100)]
staging: r8188eu: clean up on_action_public

Use the struct mgmt to read the action_code. This is much simpler than
parsing the message ourselves.

Add a comment about reading the action code. All members of the action
enum start with an action_code byte. It does not matter which member we
use.

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/20221030173326.1588647-10-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: replace GetAddr1Ptr call in OnAction_p2p
Martin Kaiser [Sun, 30 Oct 2022 17:33:21 +0000 (18:33 +0100)]
staging: r8188eu: replace GetAddr1Ptr call in OnAction_p2p

Define a struct ieee80211_mgmt in OnAction_p2p and use it to check the
destination address. This replaces a call to the driver-specific
GetAddr1Ptr 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/20221030173326.1588647-9-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: replace switch-case with if
Martin Kaiser [Sun, 30 Oct 2022 17:33:20 +0000 (18:33 +0100)]
staging: r8188eu: replace switch-case with if

OnAction_p2p has a switch-case statement where only a single case is
handled. Use if instead, this makes the code shorter and easier to read.

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/20221030173326.1588647-8-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: remove category check in OnAction_p2p
Martin Kaiser [Sun, 30 Oct 2022 17:33:19 +0000 (18:33 +0100)]
staging: r8188eu: remove category check in OnAction_p2p

The caller of OnAction_p2p has already checked the action category. We can
remove the check in OnAction_p2p.

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/20221030173326.1588647-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: make OnAction_p2p static void
Martin Kaiser [Sun, 30 Oct 2022 17:33:18 +0000 (18:33 +0100)]
staging: r8188eu: make OnAction_p2p static void

OnAction_p2p is called only by OnAction, its return value is not checked.
We can make it a static 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/20221030173326.1588647-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: make OnAction_back static void
Martin Kaiser [Sun, 30 Oct 2022 17:33:17 +0000 (18:33 +0100)]
staging: r8188eu: make OnAction_back static void

OnAction_back is called only by OnAction, its return value is not checked.
We can make it a static 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/20221030173326.1588647-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: make on_action_public static void
Martin Kaiser [Sun, 30 Oct 2022 17:33:16 +0000 (18:33 +0100)]
staging: r8188eu: make on_action_public static void

The on_action_public function is called only by OnAction. This function
also lives in rtw_mlme_ext.c and does not check the return value from
on_action_public.

We can make on_action_public a static void function.

The ret variable is no longer needed if we don't return a value. It can
be removed.

Reported-by: kernel test robot <lkp@intel.com>
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/20221030173326.1588647-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: remove duplicate category check
Martin Kaiser [Sun, 30 Oct 2022 17:33:15 +0000 (18:33 +0100)]
staging: r8188eu: remove duplicate category check

The caller of on_action_public has already checked the action category. We
can remove the check in on_action_public.

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/20221030173326.1588647-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: replace a GetAddr1Ptr call
Martin Kaiser [Sun, 30 Oct 2022 17:33:14 +0000 (18:33 +0100)]
staging: r8188eu: replace a GetAddr1Ptr call

Define a struct ieee80211_mgmt and use it to read the destination address.

This replaces one call to the driver-specific GetAddr1Ptr function, which
should eventually be removed.

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/20221030173326.1588647-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8712: fix potential memory leak
Nam Cao [Tue, 25 Oct 2022 09:12:26 +0000 (11:12 +0200)]
staging: rtl8712: fix potential memory leak

In r8712_init_drv_sw(), whenever any function call returns error, it is
returned immediately without properly cleaning up the other successfully
executed functions. This can cause memory leak.

Instead of return immediately, free all the allocated buffers first.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Signed-off-by: Nam Cao <namcaov@gmail.com>
Link: https://lore.kernel.org/r/0a3414b12031f6cdcba81a8725e91eb9567ff34f.1666688642.git.namcaov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8712: check for return value of _r8712_init_xmit_priv()
Nam Cao [Tue, 25 Oct 2022 09:12:25 +0000 (11:12 +0200)]
staging: rtl8712: check for return value of _r8712_init_xmit_priv()

The return value of _r8712_init_xmit_priv() is never checked and the driver
always continue execution as if all is well. This will cause problems
if, for example, buffers cannot be allocated and the driver continue and
use those buffers.

Check for return value of _r8712_init_xmit_priv() and return error (if any)
during probing.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Signed-off-by: Nam Cao <namcaov@gmail.com>
Link: https://lore.kernel.org/r/b550803561acf26af71f2377215c28b94435a644.1666688642.git.namcaov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8712: check for alloc fail in _r8712_init_recv_priv()
Nam Cao [Tue, 25 Oct 2022 09:12:24 +0000 (11:12 +0200)]
staging: rtl8712: check for alloc fail in _r8712_init_recv_priv()

The function _r8712_init_recv_priv() and also r8712_init_recv_priv()
just returns silently if they fail to allocate memory. Change their
return type to int and add necessary checks and handling if they return
-ENOMEM

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Signed-off-by: Nam Cao <namcaov@gmail.com>
Link: https://lore.kernel.org/r/506ac35a667e511db568b06b86834fd0ceeba453.1666688642.git.namcaov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agoRevert "staging: r8712u: Tracking kmemleak false positives."
Nam Cao [Tue, 25 Oct 2022 09:12:23 +0000 (11:12 +0200)]
Revert "staging: r8712u: Tracking kmemleak false positives."

This reverts commit 5d3da4a20a271e3cf5496a50cbb8118aa019374f.

This commit annotated false positive for kmemleak. The reasoning is that
the buffers are freed when the driver is unloaded. However, there is
actually potential memory leak when probe fails.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Signed-off-by: Nam Cao <namcaov@gmail.com>
Link: https://lore.kernel.org/r/26ce206b2c40c7db48c146aa6105789db9dfcc1a.1666688642.git.namcaov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: remove get_da
Martin Kaiser [Sat, 29 Oct 2022 17:10:11 +0000 (19:10 +0200)]
staging: r8188eu: remove get_da

Replace the last get_da call with ieee80211_get_DA and remove the get_da
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/20221029171011.1572091-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: replace get_da with ieee80211_get_DA
Martin Kaiser [Sat, 29 Oct 2022 17:10:10 +0000 (19:10 +0200)]
staging: r8188eu: replace get_da with ieee80211_get_DA

Replace a call to the driver-specific get_da function with
ieee80211_get_DA from ieee80211.h.

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/20221029171011.1572091-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: rtllib_crypt_tkip: rewritten comparison to NULL
Aaron Lawrence [Wed, 26 Oct 2022 12:43:51 +0000 (19:43 +0700)]
staging: rtl8192e: rtllib_crypt_tkip: rewritten comparison to NULL

Rewritten a comparison to NULL with a negation operator in
accordance with the Linux kernel coding-style regulations. The fix
was directly recommended by the checkpatch script.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Signed-off-by: Aaron Lawrence <t4rmin@zohomail.com>
Link: https://lore.kernel.org/r/ca33296630627020694f4b653580f689a8a3d1c7.1666787061.git.t4rmin@zohomail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: rtllib_crypt_tkip: split multiple assignments
Aaron Lawrence [Wed, 26 Oct 2022 12:42:55 +0000 (19:42 +0700)]
staging: rtl8192e: rtllib_crypt_tkip: split multiple assignments

Split a multiple assignments statement to individual assignments
on different lines in accordance with the Linux kernel coding-style
regulations. Also repositioned comments on it and the statement
before for increased legibility. The multiple assignments issue
was found by the checkpatch script, with the comments legibility
issue were through direct observation.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Signed-off-by: Aaron Lawrence <t4rmin@zohomail.com>
Link: https://lore.kernel.org/r/a9ab257d0042afd3b3231eefe4f58c0c3ac7649f.1666787061.git.t4rmin@zohomail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: rtllib_crypt_tkip: fixes on unbalanced braces
Aaron Lawrence [Wed, 26 Oct 2022 12:41:56 +0000 (19:41 +0700)]
staging: rtl8192e: rtllib_crypt_tkip: fixes on unbalanced braces

Added braces around needed arms of statements which needs them
in accordance with the Linux kernel coding-style regulations.
The issues were found with the help of the checkpatch script.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Signed-off-by: Aaron Lawrence <t4rmin@zohomail.com>
Link: https://lore.kernel.org/r/641d8360c5f86b54efc96d7f8ef70be1371db480.1666787061.git.t4rmin@zohomail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: rtllib_crypt_tkip: fixed alignment matching open parentheses
Aaron Lawrence [Wed, 26 Oct 2022 12:41:08 +0000 (19:41 +0700)]
staging: rtl8192e: rtllib_crypt_tkip: fixed alignment matching open parentheses

Aligned multiple lines to be at the same indentation of open
parentheses before it in accordance with the Linux kernel
coding-style regulations. The issues were found by running the
checkpatch script on the file.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Signed-off-by: Aaron Lawrence <t4rmin@zohomail.com>
Link: https://lore.kernel.org/r/4253b94d6b7d94713afb02fa63d0a98686e77cc1.1666787061.git.t4rmin@zohomail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: rtllib_crypt_tkip: blank line before close brace removal
Aaron Lawrence [Wed, 26 Oct 2022 12:40:15 +0000 (19:40 +0700)]
staging: rtl8192e: rtllib_crypt_tkip: blank line before close brace removal

Removed multiple blank lines that are not necessary before a closing
brace. The issues were found with the checkpatch script and were
dealt with in accordance with the Linux kernel coding-style guidelines.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Signed-off-by: Aaron Lawrence <t4rmin@zohomail.com>
Link: https://lore.kernel.org/r/1ba11754f1b1e39b1525a837b8493ba8434d5e3b.1666787061.git.t4rmin@zohomail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: rtllib_crypt_tkip: multiple blank lines removal
Aaron Lawrence [Wed, 26 Oct 2022 12:39:28 +0000 (19:39 +0700)]
staging: rtl8192e: rtllib_crypt_tkip: multiple blank lines removal

Removed multiple unnecessary blank lines in accordance with the
Linux kernel coding-style regulations. The issues were reported by
the checkpatch script.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Signed-off-by: Aaron Lawrence <t4rmin@zohomail.com>
Link: https://lore.kernel.org/r/f2103758c23f37b61fcbe14f8ed0da8d6b31f5c6.1666787061.git.t4rmin@zohomail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: Rename variables rateIndex and rateBitmap to avoid CamelCase
Yogesh Hegde [Sun, 30 Oct 2022 13:32:04 +0000 (19:02 +0530)]
staging: rtl8192e: Rename variables rateIndex and rateBitmap to avoid CamelCase

Rename variables
* rateIndex to rate_index
* rateBitmap to rate_bitmap
to avoid CamelCase which is not accepted by checkpatch.pl .

Signed-off-by: Yogesh Hegde <yogi.kernel@gmail.com>
Link: https://lore.kernel.org/r/20221030133204.GA416592@zephyrus
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: rtllib_module: remove unnecessary parentheses
Aaron Lawrence [Thu, 27 Oct 2022 13:56:27 +0000 (20:56 +0700)]
staging: rtl8192e: rtllib_module: remove unnecessary parentheses

This patch is intended to remove unnecessary parentheses in the
rtllib_module.c file following the Linux kernel coding-style
regulations. The modification is recommended by the checkpatch script.

Signed-off-by: Aaron Lawrence <t4rmin@zohomail.com>
Link: https://lore.kernel.org/r/20221027135627.vzc3woeuhrivozqz@plymouth
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: make rtw_sta_flush to void
Kang Minchul [Tue, 25 Oct 2022 17:06:21 +0000 (02:06 +0900)]
staging: r8188eu: make rtw_sta_flush to void

Make function rtw_sta_flush to void in order to
prevent cocci warning as follows:

  Unneeded variable: "ret". Return "0" on line 1031

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Kang Minchul <tegongkang@gmail.com>
Link: https://lore.kernel.org/r/20221025170621.271903-5-tegongkang@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: remove unnecessary variable in rtl8188eu_xmit
Kang Minchul [Tue, 25 Oct 2022 17:06:20 +0000 (02:06 +0900)]
staging: r8188eu: remove unnecessary variable in rtl8188eu_xmit

Return 0 directly instead of storing it in a variable.
This can prevent cocci warning as follows:

  Unneeded variable: "pull". Return "0" on line 298

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Kang Minchul <tegongkang@gmail.com>
Link: https://lore.kernel.org/r/20221025170621.271903-4-tegongkang@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: remove unnecessary vaiable in rtw_recv
Kang Minchul [Tue, 25 Oct 2022 17:06:19 +0000 (02:06 +0900)]
staging: r8188eu: remove unnecessary vaiable in rtw_recv

Return _SUCCESS directly instead of storing it in a variable.
This can prevent cocci warning as follows:

  Unneeded variable: "ret". Return "_SUCCESS" on line 1516

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Kang Minchul <tegongkang@gmail.com>
Link: https://lore.kernel.org/r/20221025170621.271903-3-tegongkang@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: remove unnecessary variable in ioctl_linux
Kang Minchul [Tue, 25 Oct 2022 17:06:18 +0000 (02:06 +0900)]
staging: r8188eu: remove unnecessary variable in ioctl_linux

Returning value 0 directly instead of storing it in variable ret.
This commit can prevent cocci warning as follows:

  Unneeded variable: "ret". Return "0" on line 3030

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Kang Minchul <tegongkang@gmail.com>
Link: https://lore.kernel.org/r/20221025170621.271903-2-tegongkang@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: use min() instead of ternary operator
Michael Straube [Sun, 30 Oct 2022 08:10:20 +0000 (09:10 +0100)]
staging: r8188eu: use min() instead of ternary operator

Replace a ternary operator usage with the min() macro to improve
readability.

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/20221030081020.8533-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8723bs: replace ternary statement with min_t macro
Emily Peri [Fri, 28 Oct 2022 18:39:19 +0000 (11:39 -0700)]
staging: rtl8723bs: replace ternary statement with min_t macro

Ternary statements that pick the min of two values can be replaced by
the macro min_t(). This improves readability, since its quicker to
understand min_t(type, x, y) than x < y ? x : y. Issue found by
coccicheck.

Signed-off-by: Emily Peri <eperi1024@gmail.com>
Link: https://lore.kernel.org/r/Y1wh1zYMAbbKSrGB@marshmallow
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: r8188eu: remove unused macros from wifi.h
Michael Straube [Tue, 25 Oct 2022 15:27:22 +0000 (17:27 +0200)]
staging: r8188eu: remove unused macros from wifi.h

There are some unused macros in wifi.h. Remove them.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20221025152722.14926-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8192e: rtllib_crypt_wep: multiple blank lines removal
Aaron Lawrence [Tue, 25 Oct 2022 10:44:02 +0000 (17:44 +0700)]
staging: rtl8192e: rtllib_crypt_wep: multiple blank lines removal

Removal of multiple unnecessary blank lines in accordance with the
Linux kernel coding-style regulations. Said issues ware detected on
this file by the checkpatch script.

Signed-off-by: Aaron Lawrence <t4rmin@zohomail.com>
Link: https://lore.kernel.org/r/20221025104402.xvbfobi7sdnwlqs2@plymouth
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agostaging: rtl8723bs: Fix indentation in conditional statements
Emily Peri [Mon, 24 Oct 2022 21:47:25 +0000 (14:47 -0700)]
staging: rtl8723bs: Fix indentation in conditional statements

Remove/add tabs in block statements in rtl8723bs/core to fix checkpatch
warnings for suspect code indent for conditionals.

Signed-off-by: Emily Peri <eperi1024@gmail.com>
Link: https://lore.kernel.org/r/Y1cH7br3mMcT4Dm5@marshmallow
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agoStaging: rtl8192e: rtllib_tx: removed unnecessary blank line before a close brace
Aaron Lawrence [Mon, 24 Oct 2022 12:30:28 +0000 (19:30 +0700)]
Staging: rtl8192e: rtllib_tx: removed unnecessary blank line before a close brace

Removed a blank line before a closing brace as it is not necessary
as per the Linux coding-style regulations. The issue was flagged by
the checkpatch script.

Signed-off-by: Aaron Lawrence <t4rmin@zohomail.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/234a3e8d21080ae2a1f75127a5c1a0ed131db924.1666612946.git.t4rmin@zohomail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agoStaging: rtl8192e: rtllib_tx: fixed lines ending with an open parenthesis
Aaron Lawrence [Mon, 24 Oct 2022 12:29:14 +0000 (19:29 +0700)]
Staging: rtl8192e: rtllib_tx: fixed lines ending with an open parenthesis

Fixed several lines that end with an open parenthesis to not end
with it anymore, as per the Linux kernel coding-style regulations.
The issues were flagged by the checkpatch script.

Signed-off-by: Aaron Lawrence <t4rmin@zohomail.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/a8e67d281b4e9ab1254e0b58294f566994ac7d9d.1666612946.git.t4rmin@zohomail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 months agoStaging: rtl8192e: rtllib_tx: added spaces around operators
Aaron Lawrence [Mon, 24 Oct 2022 12:27:59 +0000 (19:27 +0700)]
Staging: rtl8192e: rtllib_tx: added spaces around operators

Added multiple spaces around operators which needs it as per the
Linux kernel coding-style regulations. The issues were flagged by
the checkpatch script.

Signed-off-by: Aaron Lawrence <t4rmin@zohomail.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/b8bf422436ff4b2d9b530c61ebf814582ab8836a.1666612946.git.t4rmin@zohomail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>