linux.git
3 years agostaging: gdm724x: Replace one-element array with flexible-array member
Gustavo A. R. Silva [Fri, 4 Feb 2022 23:29:44 +0000 (17:29 -0600)]
staging: gdm724x: Replace one-element array with flexible-array member

There is a regular need in the kernel to provide a way to declare having
a dynamically sized set of trailing elements in a structure. Kernel code
should always use “flexible array members”[1] for these cases. The older
style of one-element or zero-length arrays should no longer be used[2].

This helps with the ongoing efforts to globally enable -Warray-bounds
and get us closer to being able to tighten the FORTIFY_SOURCE routines
on memcpy().

This issue was found with the help of Coccinelle and audited and fixed,
manually.

[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays

Link: https://github.com/KSPP/linux/issues/79
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20220204232944.GA454945@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: usb_suspend_sema is initialised but not used
Martin Kaiser [Sun, 6 Feb 2022 17:59:24 +0000 (18:59 +0100)]
staging: r8188eu: usb_suspend_sema is initialised but not used

usb_suspend_sema from struct dvobj_priv is initialised but never used.
Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206175925.461426-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: RegUsbSS is not used
Martin Kaiser [Sun, 6 Feb 2022 17:59:23 +0000 (18:59 +0100)]
staging: r8188eu: RegUsbSS is not used

RegUsbSS in struct dvobj_priv is not used. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206175925.461426-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: dvobj_priv's signal_strength is not used
Martin Kaiser [Sun, 6 Feb 2022 17:59:22 +0000 (18:59 +0100)]
staging: r8188eu: dvobj_priv's signal_strength is not used

signal_strength is struct dvobj_priv is not used. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206175925.461426-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: usb_vendor_req_mutex is not used
Martin Kaiser [Sun, 6 Feb 2022 17:59:21 +0000 (18:59 +0100)]
staging: r8188eu: usb_vendor_req_mutex is not used

usb_vendor_req_mutex in struct dvobj_priv is not used.
Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206175925.461426-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unused struct hostapd_priv
Martin Kaiser [Sun, 6 Feb 2022 16:18:09 +0000 (17:18 +0100)]
staging: r8188eu: remove unused struct hostapd_priv

struct hostapd_priv contains only a pointer to struct adapter.

Remove this struct and the unused phostapdpriv pointer in struct adapter.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206161809.423031-15-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: not_indic_disco is unused
Martin Kaiser [Sun, 6 Feb 2022 16:18:08 +0000 (17:18 +0100)]
staging: r8188eu: not_indic_disco is unused

not_indic_disco in struct mlme_priv is not used. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206161809.423031-14-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: irq_alloc is not used
Martin Kaiser [Sun, 6 Feb 2022 16:18:07 +0000 (17:18 +0100)]
staging: r8188eu: irq_alloc is not used

irq_alloc in struct dvobj_priv is not used. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206161809.423031-13-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: in_cta_test is always 0
Martin Kaiser [Sun, 6 Feb 2022 16:18:06 +0000 (17:18 +0100)]
staging: r8188eu: in_cta_test is always 0

in_cta_test in struct adapter is never set, so it's always 0.

Remove in_cta_test and related dead code.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206161809.423031-12-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unused struct adapter components
Martin Kaiser [Sun, 6 Feb 2022 16:18:05 +0000 (17:18 +0100)]
staging: r8188eu: remove unused struct adapter components

Remove a number of unused components from struct adapter.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206161809.423031-11-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove the global DriverState
Martin Kaiser [Sun, 6 Feb 2022 16:18:04 +0000 (17:18 +0100)]
staging: r8188eu: remove the global DriverState

DriverState in struct adapter is never set. It remains 0 (DRIVER_NORMAL)
all the time, DriverState != DRIVER_DISAPPEAR is always true.

Both DriverState and the check can be removed. enum driver_state contains
the possible values of DriverState. This enum can be removed as well.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206161809.423031-10-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unused enum _ADAPTER_TYPE
Martin Kaiser [Sun, 6 Feb 2022 16:18:03 +0000 (17:18 +0100)]
staging: r8188eu: remove unused enum _ADAPTER_TYPE

enum _ADAPTER_TYPE is not used. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206161809.423031-9-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unused enum _IFACE_TYPE
Martin Kaiser [Sun, 6 Feb 2022 16:18:02 +0000 (17:18 +0100)]
staging: r8188eu: remove unused enum _IFACE_TYPE

enum _IFACE_TYPE is not used. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206161809.423031-8-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: move local definitions into rtw_fw.h
Martin Kaiser [Sun, 6 Feb 2022 16:18:01 +0000 (17:18 +0100)]
staging: r8188eu: move local definitions into rtw_fw.h

Move some defines and the definition of struct rt_firmware_hdr
from rtw_fw.h to rtw_fw.c. These definitions are used only by
the fw layer.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206161809.423031-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove debug code to bypass IQ calibration
Martin Kaiser [Sun, 6 Feb 2022 16:18:00 +0000 (17:18 +0100)]
staging: r8188eu: remove debug code to bypass IQ calibration

Remove a check before the IQ calibration that is always false.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206161809.423031-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove debug code to bypass LC calibration
Martin Kaiser [Sun, 6 Feb 2022 16:17:59 +0000 (17:17 +0100)]
staging: r8188eu: remove debug code to bypass LC calibration

Remove a check before the LC calibration that is always false.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206161809.423031-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: replace local OFDM_index with single variable
Martin Kaiser [Sun, 6 Feb 2022 16:17:58 +0000 (17:17 +0100)]
staging: r8188eu: replace local OFDM_index with single variable

Replace the local OFDM_index array in the
odm_TXPowerTrackingCallback_ThermalMeter_8188E function
with a single variable. Only its first component is used.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206161809.423031-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: only OFDM_index[0] is used
Martin Kaiser [Sun, 6 Feb 2022 16:17:57 +0000 (17:17 +0100)]
staging: r8188eu: only OFDM_index[0] is used

Replace the OFDM_index array in struct odm_rf_cal with a single variable.
Only its first component is used.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206161809.423031-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: only OFDM_index_old[0] is used
Martin Kaiser [Sun, 6 Feb 2022 16:17:56 +0000 (17:17 +0100)]
staging: r8188eu: only OFDM_index_old[0] is used

The odm_TXPowerTrackingCallback_ThermalMeter_8188E function uses only
OFDM_index_old[0]. Use a single variable instead of an array.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220206161809.423031-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove UsbBulkOutSize from struct hal_data_8188e
Michael Straube [Sun, 6 Feb 2022 14:44:07 +0000 (15:44 +0100)]
staging: r8188eu: remove UsbBulkOutSize from struct hal_data_8188e

UsbBulkOutSize in struct hal_data_8188e is only used to set a local
variable in rtl8188eu_xmitframe_complete(). Set the local variable
directly and remove UsbBulkOutSize from the hal_data_8188e structure.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220206144407.8397-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: limit rf register writes to path a
Martin Kaiser [Sat, 5 Feb 2022 11:37:41 +0000 (12:37 +0100)]
staging: r8188eu: limit rf register writes to path a

The r8188eu driver uses only RF_PATH_A.

At the moment, the only exception are private ioctls. It does not make
sense if these ioctls set registers that are not used anywhere else in
the driver.

This patch limits the private ioctl 0x0C, i.e. the rtw_wx_write_rf
function, to RF_PATH_A. For any other setting, we return an error
saying the parameter is invalid.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220205113741.379070-9-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: use a define for the radio path
Martin Kaiser [Sat, 5 Feb 2022 11:37:40 +0000 (12:37 +0100)]
staging: r8188eu: use a define for the radio path

Replace (enum rf_radio_path)0 with RF_PATH_A. This should make it
easier to see which path is selected.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220205113741.379070-8-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: RfRegChnlVal[1] is set but not used
Martin Kaiser [Sat, 5 Feb 2022 11:37:39 +0000 (12:37 +0100)]
staging: r8188eu: RfRegChnlVal[1] is set but not used

RfRegChnlVal[1] in hal_data_8188e is set but not used. This driver needs
only one RfRegChnlVal setting. Replace the array with a single u32.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220205113741.379070-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove constant rf variable
Martin Kaiser [Sat, 5 Feb 2022 11:37:38 +0000 (12:37 +0100)]
staging: r8188eu: remove constant rf variable

The rf variable in odm_TXPowerTrackingCallback_ThermalMeter_8188E
is always 1. The for loops that use rf will be executed only once.

We can remove the variable and the loops.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220205113741.379070-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: bTXPowerTracking is set but not used
Martin Kaiser [Sat, 5 Feb 2022 11:37:37 +0000 (12:37 +0100)]
staging: r8188eu: bTXPowerTracking is set but not used

bTXPowerTracking in struct odm_rf_cal is set but not used.
Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220205113741.379070-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: bTXPowerTrackingInit is set but not used
Martin Kaiser [Sat, 5 Feb 2022 11:37:36 +0000 (12:37 +0100)]
staging: r8188eu: bTXPowerTrackingInit is set but not used

bTXPowerTrackingInit in struct odm_rf_cal is set but not used.
Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220205113741.379070-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: TXPowerTrackingCallbackCnt is set but not used
Martin Kaiser [Sat, 5 Feb 2022 11:37:35 +0000 (12:37 +0100)]
staging: r8188eu: TXPowerTrackingCallbackCnt is set but not used

TXPowerTrackingCallbackCnt in struct odm_rf_cal is set but not used.
Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220205113741.379070-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: TXPowercount is set but not used
Martin Kaiser [Sat, 5 Feb 2022 11:37:34 +0000 (12:37 +0100)]
staging: r8188eu: TXPowercount is set but not used

TXPowercount in struct odm_rf_cal is set but not used.
Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220205113741.379070-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove constant variable eRFPath
Martin Kaiser [Fri, 4 Feb 2022 09:09:41 +0000 (10:09 +0100)]
staging: r8188eu: remove constant variable eRFPath

In the _PHY_SwChnl8192C function, eRFPath is always zero. Remove the
variable and use 0 in the code. Replace (enum rf_radio_path)0 with
RF_PATH_A.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220204090941.309900-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove constant parameter of odm_ConfigRFReg_8188E
Martin Kaiser [Fri, 4 Feb 2022 09:09:40 +0000 (10:09 +0100)]
staging: r8188eu: remove constant parameter of odm_ConfigRFReg_8188E

The only caller of odm_ConfigRFReg_8188E sets RF_PATH to RF_PATH_A.
Remove this parameter and use RF_PATH_A inside the function.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220204090941.309900-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove dead code for tx power tracking
Martin Kaiser [Fri, 4 Feb 2022 09:09:39 +0000 (10:09 +0100)]
staging: r8188eu: remove dead code for tx power tracking

The odm_TXPowerTrackingCallback_ThermalMeter_8188E contains code
for OFDM paths A and B. It seems that path B is not used, is2t is
always false. Remove resulting dead code.

Without the path B code, the ele_A and ele_C variables are set but
not used. They can be removed. With ele_A and ele_C gone, X and Y
are now set but no longer used. Remove them as well.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220204090941.309900-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E
Martin Kaiser [Fri, 4 Feb 2022 09:09:38 +0000 (10:09 +0100)]
staging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E

The only caller of phy_LCCalibrate_8188E sets is2t to false.
Remove this parameter and resulting dead code.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220204090941.309900-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: pi433: add debugfs interface
Paulo Miguel Almeida [Fri, 4 Feb 2022 08:04:32 +0000 (21:04 +1300)]
staging: pi433: add debugfs interface

This adds debugfs interface that can be used for debugging possible
hardware/software issues.

It currently exposes the following debugfs entries for each SPI device
probed:

  /sys/kernel/debug/pi433/<DEVICE>/regs
  ...

The 'regs' file contains all rf69 uC registers values that are useful
for troubleshooting misconfigurations between 2 devices. It contains one
register per line so it should be easy to use normal filtering tools to
find the registers of interest if needed.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
Link: https://lore.kernel.org/r/YfzeEHJcd+qvYGZ8@mail.google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: simplify error handling in phy_BB8188E_Config_ParaFile
Martin Kaiser [Thu, 3 Feb 2022 20:17:45 +0000 (21:17 +0100)]
staging: r8188eu: simplify error handling in phy_BB8188E_Config_ParaFile

Simplify error handling in phy_BB8188E_Config_ParaFile. Exit immediately
when there's an error, do not jump to the end of the function. We do not
have anything to clean up before we return.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220203201745.251826-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unnecessary error check
Martin Kaiser [Thu, 3 Feb 2022 20:17:44 +0000 (21:17 +0100)]
staging: r8188eu: remove unnecessary error check

Remove an unnecessary error check in phy_BB8188E_Config_ParaFile.
There's no need to goto phy_BB8190_Config_ParaFile_Fail, this label
is in the following line.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220203201745.251826-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: vt6656: Fix crash when WLAN is turned off
Philipp Hortmann [Thu, 3 Feb 2022 19:22:01 +0000 (20:22 +0100)]
staging: vt6656: Fix crash when WLAN is turned off

Stop submitting urbs before calling usb_kill_urb() and usb_free_urb().

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/20220203192201.GA18509@matrix-ESPRIMO-P710
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: move struct rt_firmware_hdr to rtw_fw.h
Michael Straube [Wed, 2 Feb 2022 07:50:51 +0000 (08:50 +0100)]
staging: r8188eu: move struct rt_firmware_hdr to rtw_fw.h

The structure rt_firmware_hdr is firmware related. Move it to the
rtw_fw.h header.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220202075051.21266-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove UsbRxAggPage* from struct hal_data_8188e
Michael Straube [Tue, 1 Feb 2022 08:42:59 +0000 (09:42 +0100)]
staging: r8188eu: remove UsbRxAggPage* from struct hal_data_8188e

UsbRxAggPageCount and UsbRxAggPageTimeout in struct hal_data_8188e
are set and never changed. Define these constants and remove the
variables from the hal_data_8188e structure.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220201084259.7497-10-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove UsbRxAggBlock* from struct hal_data_8188e
Michael Straube [Tue, 1 Feb 2022 08:42:58 +0000 (09:42 +0100)]
staging: r8188eu: remove UsbRxAggBlock* from struct hal_data_8188e

UsbRxAggBlockCount and UsbRxAggBlockTimeout in struct hal_data_8188e
are set but not used. Remove them.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220201084259.7497-9-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove UsbRxAggMode from struct hal_data_8188e
Michael Straube [Tue, 1 Feb 2022 08:42:57 +0000 (09:42 +0100)]
staging: r8188eu: remove UsbRxAggMode from struct hal_data_8188e

UsbRxAggMode in struct hal_data_8188e is set to USB_RX_AGG_DMA and
never changed. Remove UsbRxAggMode from the hal_data_8188e structure
and remove related dead code.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220201084259.7497-8-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove UsbTxAggMode from struct hal_data_8188e
Michael Straube [Tue, 1 Feb 2022 08:42:56 +0000 (09:42 +0100)]
staging: r8188eu: remove UsbTxAggMode from struct hal_data_8188e

UsbTxAggMode in struct hal_data_r8188e is only used in a single if
statement. Remove UsbTxAggMode from the hal_data_8188e structure and
adjust the if statement.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220201084259.7497-7-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove UsbTxAggDescNum from struct hal_data_8188e
Michael Straube [Tue, 1 Feb 2022 08:42:55 +0000 (09:42 +0100)]
staging: r8188eu: remove UsbTxAggDescNum from struct hal_data_8188e

UsbTxAggDescNum in struct hal_data_8188e is set to 0x6 and never
changed. Define this constant and remove UsbTxAggDescNum from the
hal_data_8188e structure.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220201084259.7497-6-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: BasicRateSet is set but never used
Michael Straube [Tue, 1 Feb 2022 08:42:54 +0000 (09:42 +0100)]
staging: r8188eu: BasicRateSet is set but never used

The varaible BasicRateSet in struct hal_data_8188e is set but never
used. Remove it.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220201084259.7497-5-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove ReceiveConfig from struct hal_data_8188e
Michael Straube [Tue, 1 Feb 2022 08:42:53 +0000 (09:42 +0100)]
staging: r8188eu: remove ReceiveConfig from struct hal_data_8188e

The ReceiveConfig variable in struct hal_data_8188e is only used
to store a local value. Use a local variable instead and remove
ReceiveConfig from struct hal_data_8188e.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220201084259.7497-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove PGMaxGroup from struct hal_data_8188e
Michael Straube [Tue, 1 Feb 2022 08:42:52 +0000 (09:42 +0100)]
staging: r8188eu: remove PGMaxGroup from struct hal_data_8188e

the variable PGMaxGroup in struct hal_data_8188e is set to 13 and
never changed. We can use the already defined constant MAX_PG_GROUP,
which is 13, and remove PGMaxGroup from struct hal_data_8188e.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220201084259.7497-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: ExternalPA is read-only
Michael Straube [Tue, 1 Feb 2022 08:42:51 +0000 (09:42 +0100)]
staging: r8188eu: ExternalPA is read-only

The variable ExternalPA in struct hal_data_8188e is never set.
It stays at the default value 0. Remove it and remove related
dead code.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220201084259.7497-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: Silence out-of-bounds warning in HT_caps_handler()
Gustavo A. R. Silva [Wed, 2 Feb 2022 07:09:06 +0000 (01:09 -0600)]
staging: r8188eu: Silence out-of-bounds warning in HT_caps_handler()

Silence the following out-of-bounds warning (caught with -Warray-bounds=2):

drivers/staging/r8188eu/core/rtw_wlan_util.c: In function ‘HT_caps_handler’:
drivers/staging/r8188eu/core/rtw_wlan_util.c:719:54: error: array subscript 2 is above array bounds of ‘u8[1]’ {aka ‘unsigned char[1]’} [-Werror=array-bounds]
  719 |                                             pIE->data[i] & 0x3);
      |                                             ~~~~~~~~~^~~
./include/linux/minmax.h:32:39: note: in definition of macro ‘__cmp_once’
   32 |                 typeof(y) unique_y = (y);               \
      |                                       ^
./include/linux/minmax.h:45:25: note: in expansion of macro ‘__careful_cmp’
   45 | #define min(x, y)       __careful_cmp(x, y, <)
      |                         ^~~~~~~~~~~~~
drivers/staging/r8188eu/core/rtw_wlan_util.c:718:41: note: in expansion of macro ‘min’
  718 |                         max_AMPDU_len = min(pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3,
      |                                         ^~~
In file included from drivers/staging/r8188eu/core/../include/drv_types.h:16,
                 from drivers/staging/r8188eu/core/rtw_wlan_util.c:7:
drivers/staging/r8188eu/core/../include/wlan_bssdef.h:64:13: note: while referencing ‘data’
   64 |         u8  data[1];
      |             ^~~~

by transforming one-element array into a flexible-array member in
struct ndis_802_11_var_ie

This is part of the ongoing efforts to globally enable -Warray-bounds.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20220202070906.GA274379@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove HW_VAR_CAM_EMPTY_ENTRY
Michael Straube [Sun, 30 Jan 2022 19:03:21 +0000 (20:03 +0100)]
staging: r8188eu: remove HW_VAR_CAM_EMPTY_ENTRY

The HW_VAR_CAM_EMPTY_ENTRY case in SetHwReg8188EU() is not used.
Remove it.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130190321.7172-13-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove HW_VAR_CHECK_BSSID
Michael Straube [Sun, 30 Jan 2022 19:03:20 +0000 (20:03 +0100)]
staging: r8188eu: remove HW_VAR_CHECK_BSSID

The HW_VAR_CHECK_BSSID case in SetHwReg8188EU() is not used.
Remove it.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130190321.7172-12-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove HW_VAR_BCN_FUNC
Michael Straube [Sun, 30 Jan 2022 19:03:19 +0000 (20:03 +0100)]
staging: r8188eu: remove HW_VAR_BCN_FUNC

The HW_VAR_BCN_FUNC case in SetHwReg8188EU() just calls
hw_var_set_bcn_func(). Remove HW_VAR_BCN_FUNC from SetHwReg8188EU(),
remove hw_var_set_bcn_func() and call rtw_write8() directly.

Since hw_var_set_bcn_func() was always called with value 0, we only
need to keep the else arm of the if statement that checks the value.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130190321.7172-11-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove HW_VAR_CAM_WRITE
Michael Straube [Sun, 30 Jan 2022 19:03:18 +0000 (20:03 +0100)]
staging: r8188eu: remove HW_VAR_CAM_WRITE

Remove HW_VAR_CAM_WRITE from SetHwReg8188EU() and call rtw_write32()
directly.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130190321.7172-10-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: merge Set_NETYPE0_MSR() and Set_MSR()
Michael Straube [Sun, 30 Jan 2022 19:03:17 +0000 (20:03 +0100)]
staging: r8188eu: merge Set_NETYPE0_MSR() and Set_MSR()

Set_MSR() just calls Set_NETYPE0_MSR(). Merge the two functions.
Keep Set_MSR() and remove Set_NETYPE0_MSR().

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130190321.7172-9-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove HW_VAR_MEDIA_STATUS
Michael Straube [Sun, 30 Jan 2022 19:03:16 +0000 (20:03 +0100)]
staging: r8188eu: remove HW_VAR_MEDIA_STATUS

Remove HW_VAR_MEDIA_STATUS from SetHwReg8188EU() and call
rtw_read8() and rtw_write8() directly.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130190321.7172-8-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove HW_VAR_AC_PARAM_BK
Michael Straube [Sun, 30 Jan 2022 19:03:15 +0000 (20:03 +0100)]
staging: r8188eu: remove HW_VAR_AC_PARAM_BK

Remove HW_VAR_AC_PARAM_BK from SetHwReg8188EU() and call
rtw_write32() directly.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130190321.7172-7-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove HW_VAR_AC_PARAM_VI
Michael Straube [Sun, 30 Jan 2022 19:03:14 +0000 (20:03 +0100)]
staging: r8188eu: remove HW_VAR_AC_PARAM_VI

Remove HW_VAR_AC_PARAM_VI from SetHwReg8188EU() and call
rtw_write32() directly.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130190321.7172-6-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove HW_VAR_AC_PARAM_VO
Michael Straube [Sun, 30 Jan 2022 19:03:13 +0000 (20:03 +0100)]
staging: r8188eu: remove HW_VAR_AC_PARAM_VO

Remove HW_VAR_AC_PARAM_VO from SetHwReg8188EU() and call
rtw_write32() directly.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130190321.7172-5-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove HW_VAR_CAM_INVALID_ALL
Michael Straube [Sun, 30 Jan 2022 19:03:12 +0000 (20:03 +0100)]
staging: r8188eu: remove HW_VAR_CAM_INVALID_ALL

Remove HW_VAR_CAM_INVALID_ALL from SetHwReg8188EU() and call
rtw_write32() directly.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130190321.7172-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove HW_VAR_SEC_CFG
Michael Straube [Sun, 30 Jan 2022 19:03:11 +0000 (20:03 +0100)]
staging: r8188eu: remove HW_VAR_SEC_CFG

Remove HW_VAR_SEC_CFG from SetHwReg8188EU() and call rtw_write8()
directly.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130190321.7172-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove HW_VAR_BEACON_INTERVAL
Michael Straube [Sun, 30 Jan 2022 19:03:10 +0000 (20:03 +0100)]
staging: r8188eu: remove HW_VAR_BEACON_INTERVAL

Remove HW_VAR_BEACON_INTERVAL from SetHwReg8188EU() and call
rtw_write16() directly.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130190321.7172-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert rtw_p2p_got_wpsinfo to return void
Abdun Nihaal [Sat, 29 Jan 2022 16:28:15 +0000 (21:58 +0530)]
staging: r8188eu: convert rtw_p2p_got_wpsinfo to return void

rtw_p2p_got_wpsinfo always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/f63e236e3a338789265172990fea049216115105.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert rtw_p2p_prov_disc to return void
Abdun Nihaal [Sat, 29 Jan 2022 16:28:14 +0000 (21:58 +0530)]
staging: r8188eu: convert rtw_p2p_prov_disc to return void

rtw_p2p_prov_disc always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/a6696ce2645a07ddd5b5eca21bcc04b196038e8e.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert rtw_p2p_set_persistent to return void
Abdun Nihaal [Sat, 29 Jan 2022 16:28:13 +0000 (21:58 +0530)]
staging: r8188eu: convert rtw_p2p_set_persistent to return void

rtw_p2p_set_persistent always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/2f23981bcdf4177327b9a29e88540380ef627aab.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert rtw_p2p_invite_req to return void
Abdun Nihaal [Sat, 29 Jan 2022 16:28:12 +0000 (21:58 +0530)]
staging: r8188eu: convert rtw_p2p_invite_req to return void

rtw_p2p_invite_req always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/059a21d40a5c6cbe621ca969f9d32ea89bc9a977.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert rtw_p2p_get_op_ch to return void
Abdun Nihaal [Sat, 29 Jan 2022 16:28:11 +0000 (21:58 +0530)]
staging: r8188eu: convert rtw_p2p_get_op_ch to return void

rtw_p2p_get_op_ch always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/c94caa66e738f254b7b1d967b3016975aa0df5d0.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert rtw_p2p_get_groupid to return void
Abdun Nihaal [Sat, 29 Jan 2022 16:28:10 +0000 (21:58 +0530)]
staging: r8188eu: convert rtw_p2p_get_groupid to return void

rtw_p2p_get_groupid always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/be08b2d84a7fc836db5aa008d906dee1b282fa54.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert rtw_p2p_get_peer_devaddr_by_invitation to return void
Abdun Nihaal [Sat, 29 Jan 2022 16:28:09 +0000 (21:58 +0530)]
staging: r8188eu: convert rtw_p2p_get_peer_devaddr_by_invitation to return void

rtw_p2p_get_peer_devaddr_by_invitation always returns 0 and it's return
value is not used. Convert it to return void.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/06e2dce5de14c1abe457a40ec9ca597a06095437.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert rtw_p2p_get_peer_devaddr to return void
Abdun Nihaal [Sat, 29 Jan 2022 16:28:08 +0000 (21:58 +0530)]
staging: r8188eu: convert rtw_p2p_get_peer_devaddr to return void

rtw_p2p_get_peer_devaddr always returns 0 and it's return value is not
used. Convert it to return void.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/cc077a7d11e4bda521294499c42164db7358b2e1.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert rtw_p2p_get_peer_ifaddr to return void
Abdun Nihaal [Sat, 29 Jan 2022 16:28:07 +0000 (21:58 +0530)]
staging: r8188eu: convert rtw_p2p_get_peer_ifaddr to return void

rtw_p2p_get_peer_ifaddr always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/4a51963ce86a5f6bed4c07e545cd64091eeb0a8a.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert rtw_p2p_get_role to return void
Abdun Nihaal [Sat, 29 Jan 2022 16:28:06 +0000 (21:58 +0530)]
staging: r8188eu: convert rtw_p2p_get_role to return void

rtw_p2p_get_role always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/dcd4bba9910b172031ccc0f138c78e8471e36d91.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert rtw_p2p_get_req_cm to return void
Abdun Nihaal [Sat, 29 Jan 2022 16:28:05 +0000 (21:58 +0530)]
staging: r8188eu: convert rtw_p2p_get_req_cm to return void

rtw_p2p_get_req_cm always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/a5940e6778431a4ce2d2e67543c59aae90464604.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert rtw_p2p_get_status to return void
Abdun Nihaal [Sat, 29 Jan 2022 16:28:04 +0000 (21:58 +0530)]
staging: r8188eu: convert rtw_p2p_get_status to return void

rtw_p2p_get_status always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/832c53cc201111449fccb40326084d20f676e722.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert rtw_p2p_setDN to return void
Abdun Nihaal [Sat, 29 Jan 2022 16:28:03 +0000 (21:58 +0530)]
staging: r8188eu: convert rtw_p2p_setDN to return void

rtw_p2p_setDN always returns 0 and it's return value is not used.
Convert it to return void.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/fe4a9f0176c96ec327342c793de1f55c89d16768.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert rtw_p2p_set_go_nego_ssid to return void
Abdun Nihaal [Sat, 29 Jan 2022 16:28:02 +0000 (21:58 +0530)]
staging: r8188eu: convert rtw_p2p_set_go_nego_ssid to return void

rtw_p2p_set_go_nego_ssid always returns 0 and it's return value is not
used. Convert it to return void.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/90e2b3e4ff99131423c11b8f9206916791f742d9.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: propagate error code in rtw_p2p_get2
Abdun Nihaal [Sat, 29 Jan 2022 16:28:01 +0000 (21:58 +0530)]
staging: r8188eu: propagate error code in rtw_p2p_get2

rtw_p2p_get2 calls functions that can fail with -EFAULT.
Return the error code from the called functions.

Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/818aad89738b66942bb66568081f1953a9494078.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unneeded variable in rtw_p2p_get_invitation_procedure
Abdun Nihaal [Sat, 29 Jan 2022 16:28:00 +0000 (21:58 +0530)]
staging: r8188eu: remove unneeded variable in rtw_p2p_get_invitation_procedure

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle

Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/ccec1f682fbc623381519610284530f940122d0e.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unneeded variable in rtw_p2p_get_device_name
Abdun Nihaal [Sat, 29 Jan 2022 16:27:59 +0000 (21:57 +0530)]
staging: r8188eu: remove unneeded variable in rtw_p2p_get_device_name

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle

Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/d94c3029128b9c094bf4e0b2e4574a177aef46e9.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unneeded variable in rtw_p2p_get_device_type
Abdun Nihaal [Sat, 29 Jan 2022 16:27:58 +0000 (21:57 +0530)]
staging: r8188eu: remove unneeded variable in rtw_p2p_get_device_type

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle

Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/83609e3c75a0bde4be612d32d76eaed6a26f72aa.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unneeded variable in rtw_p2p_get_go_device_address
Abdun Nihaal [Sat, 29 Jan 2022 16:27:57 +0000 (21:57 +0530)]
staging: r8188eu: remove unneeded variable in rtw_p2p_get_go_device_address

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle

Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/26a84fbef7e06d518efc29d2cd9e3dd685c96e0d.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unneeded variable in rtw_p2p_get_wps_configmethod
Abdun Nihaal [Sat, 29 Jan 2022 16:27:56 +0000 (21:57 +0530)]
staging: r8188eu: remove unneeded variable in rtw_p2p_get_wps_configmethod

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle

Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/ae35e6f6f603ef83c2bad685ac247273041bd138.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unneeded variable in rtw_p2p_get
Abdun Nihaal [Sat, 29 Jan 2022 16:27:55 +0000 (21:57 +0530)]
staging: r8188eu: remove unneeded variable in rtw_p2p_get

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle

Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/6c992e9481c7481aa5931635e162dd7a4400a2e2.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unneeded variable in rtw_wx_get_enc
Abdun Nihaal [Sat, 29 Jan 2022 16:04:08 +0000 (21:34 +0530)]
staging: r8188eu: remove unneeded variable in rtw_wx_get_enc

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle

Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/e31a2b15673497cbd70bf62b0093f46952cc7596.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unneeded variable in rtw_wx_get_essid
Abdun Nihaal [Sat, 29 Jan 2022 16:04:07 +0000 (21:34 +0530)]
staging: r8188eu: remove unneeded variable in rtw_wx_get_essid

Remove unneeded return variable that is initialized to 0 and not
assigned after.

Found using Coccinelle

Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
Link: https://lore.kernel.org/r/d0208689dffce91c52afbd5938b2704a8b1b554e.1643466748.git.abdun.nihaal@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rt8188eu: Remove dead code
Muhammad Usama Anjum [Fri, 28 Jan 2022 11:19:54 +0000 (16:19 +0500)]
staging: rt8188eu: Remove dead code

rtStatus is _SUCCESS when the execution reaches this if condition.
Remove the dead code.

Fixes: 67396d2dfef3 ("staging: r8188eu: merge ODM_ConfigBBWithHeaderFile with its callers")
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Link: https://lore.kernel.org/r/20220128111954.1028121-1-usama.anjum@collabora.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove hal_init_macaddr()
Michael Straube [Sun, 30 Jan 2022 11:12:19 +0000 (12:12 +0100)]
staging: r8188eu: remove hal_init_macaddr()

hal_init_macaddr() is just a wrapper around SetHwReg8188EU() which
calls hw_var_set_macaddr(). Remove hal_init_macaddr(), remove the
HW_VAR_MAC_ADDR case from SetHwReg8188EU() and call
hw_var_set_macaddr() directly.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130111219.6390-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unused parameter from hw_var_set_*
Michael Straube [Sun, 30 Jan 2022 11:12:18 +0000 (12:12 +0100)]
staging: r8188eu: remove unused parameter from hw_var_set_*

Remove the unused parameter 'variable' from hw_var_set_* functions.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130111219.6390-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove c2h_evt_clear()
Michael Straube [Sun, 30 Jan 2022 11:12:17 +0000 (12:12 +0100)]
staging: r8188eu: remove c2h_evt_clear()

Function c2h_evt_clear() is just a wrapper around rtw_write8().
Remove c2h_evt_clear() and call rtw_write8() directly.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220130111219.6390-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: pi433: remove coding style item from the TODO file
Paulo Miguel Almeida [Sun, 30 Jan 2022 05:08:38 +0000 (18:08 +1300)]
staging: pi433: remove coding style item from the TODO file

After several patches sent by the community along the last couple of
years, it's possible to remove the coding style item from the TODO file
in the driver's folder.

This patch addresses the last code formatting inconsistences and remove
the coding style item from the TODO file.

Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
Link: https://lore.kernel.org/r/YfYdVokxsQ+Adl+T@mail.google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove IS_*_CUT macros
Michael Straube [Fri, 28 Jan 2022 11:54:45 +0000 (12:54 +0100)]
staging: r8188eu: remove IS_*_CUT macros

Remove the IS_*_CUT macros from HalVerDef.h. They are not needed, we
can use a switch on chip_vers.CUTVersion directly in dump_chip_info()

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220128115445.6606-7-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert SetHalDefVar8188EUsb() to void
Michael Straube [Fri, 28 Jan 2022 11:54:44 +0000 (12:54 +0100)]
staging: r8188eu: convert SetHalDefVar8188EUsb() to void

The return value of SetHalDefVar8188EUsb() is not used. Convert the
function to void.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220128115445.6606-6-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: convert GetHalDefVar8188EUsb() to void
Michael Straube [Fri, 28 Jan 2022 11:54:43 +0000 (12:54 +0100)]
staging: r8188eu: convert GetHalDefVar8188EUsb() to void

The return value of GetHalDefVar8188EUsb() is not used. Convert the
function to void.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220128115445.6606-5-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: max_rx_ampdu_factor is always MAX_AMPDU_FACTOR_64K
Michael Straube [Fri, 28 Jan 2022 11:54:42 +0000 (12:54 +0100)]
staging: r8188eu: max_rx_ampdu_factor is always MAX_AMPDU_FACTOR_64K

The local variable max_rx_ampdu_factor in rtw_restructure_ht_ie() and
issue_action_BA() is always set to MAX_AMPDU_FACTOR_64K. Remove the
variable from both functions and use MAX_AMPDU_FACTOR_64K directly.

The case HW_VAR_MAX_RX_AMPDU_FACTOR in GetHalDefVar8188EUsb() is now
unused and can be removed.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220128115445.6606-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: remove unused cases from GetHalDefVar8188EUsb()
Michael Straube [Fri, 28 Jan 2022 11:54:41 +0000 (12:54 +0100)]
staging: r8188eu: remove unused cases from GetHalDefVar8188EUsb()

GetHalDefVar8188EUsb() is never called with HAL_DEF_DRVINFO_SZ,
HAL_DEF_RA_DECISION_RATE, HAL_DEF_RA_SGI and HAL_DEF_PT_PWR_STATUS.
Remove these cases from the function.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220128115445.6606-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: r8188eu: rx_packet_offset and max_recvbuf_sz are write-only
Michael Straube [Fri, 28 Jan 2022 11:54:40 +0000 (12:54 +0100)]
staging: r8188eu: rx_packet_offset and max_recvbuf_sz are write-only

The local variables rx_packet_offset and max_recvbuf_sz in
rtw_restructure_ht_ie() are set but never used. Remove them.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220128115445.6606-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: mt7621-dts: align resets with binding documentation
Sergio Paracuellos [Mon, 10 Jan 2022 11:49:30 +0000 (12:49 +0100)]
staging: mt7621-dts: align resets with binding documentation

Binding documentation for compatible 'mediatek,mt7621-sysc' has been updated
to be used as a reset provider. Align reset related bits and system controller
node with binding documentation along the dtsi file.

Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20220110114930.1406665-5-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agodt-bindings: reset: add dt binding header for Mediatek MT7621 resets
Sergio Paracuellos [Mon, 10 Jan 2022 11:49:27 +0000 (12:49 +0100)]
dt-bindings: reset: add dt binding header for Mediatek MT7621 resets

Add dt binding header for resets lines in Mediatek MT7621 SoCs.

Acked-by: Rob Herring <robh@kernel.org>
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20220110114930.1406665-2-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: unisys: visorinput: Use struct_size() helper in kzalloc()
Gustavo A. R. Silva [Tue, 25 Jan 2022 22:34:43 +0000 (16:34 -0600)]
staging: unisys: visorinput: Use struct_size() helper in kzalloc()

Make use of the struct_size() helper instead of an open-coded version,
in order to avoid any potential type mistakes or integer overflows that,
in the worst scenario, could lead to heap overflows.

Also, address the following sparse warnings:
drivers/staging/unisys/visorinput/visorinput.c:409:27: warning: using sizeof on a flexible structure

Link: https://github.com/KSPP/linux/issues/174
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20220125223443.GA76937@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: mt7621-dts: fix pinctrl properties for ethernet
Arınç ÜNAL [Tue, 25 Jan 2022 15:39:03 +0000 (18:39 +0300)]
staging: mt7621-dts: fix pinctrl properties for ethernet

Add pinctrl properties with rgmii1 & mdio pins under ethernet node which
was wrongfully put under an external phy node.
GMAC1 will start working with this fix.

Link: https://lore.kernel.org/netdev/02ecce91-7aad-4392-c9d7-f45ca1b31e0b@arinc9.com/T/
Move GB-PC2 specific phy_external node to its own device tree.

Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Link: https://lore.kernel.org/r/20220125153903.1469-5-arinc.unal@arinc9.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: mt7621-dts: use trgmii on gmac0 and enable flow control on port@6
Arınç ÜNAL [Tue, 25 Jan 2022 15:39:02 +0000 (18:39 +0300)]
staging: mt7621-dts: use trgmii on gmac0 and enable flow control on port@6

Change phy-mode of gmac0 to trgmii to match the other side, port@6.

Flow control needs to be enabled on both sides to work.
It is already enabled on gmac0, enable it on port@6 too.

Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Link: https://lore.kernel.org/r/20220125153903.1469-4-arinc.unal@arinc9.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: mt7621-dts: fix switch0@0 warnings
Arınç ÜNAL [Tue, 25 Jan 2022 15:39:01 +0000 (18:39 +0300)]
staging: mt7621-dts: fix switch0@0 warnings

Remove reg property from ports node to fix this warning:

Warning (unit_address_vs_reg): /ethernet@1e100000/mdio-bus/switch0@0/ports: node has a reg or ranges property, but no unit name

Another warning surfaces afterwards. Remove #address-cells and #size-cells
from switch0@0 node to fix this warning:

Warning (avoid_unnecessary_addr_size): /ethernet@1e100000/mdio-bus/switch0@0: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property

Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Link: https://lore.kernel.org/r/20220125153903.1469-3-arinc.unal@arinc9.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: mt7621-dts: fix formatting
Arınç ÜNAL [Tue, 25 Jan 2022 15:39:00 +0000 (18:39 +0300)]
staging: mt7621-dts: fix formatting

Fix formatting on mt7621.dtsi.

Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Link: https://lore.kernel.org/r/20220125153903.1469-2-arinc.unal@arinc9.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>