[03/13] staging: r8188eu: make on_action_public static void

Message ID 20221029172337.1574593-4-martin@kaiser.cx
State New
Headers
Series staging: r8188eu: clean up action frame handlers |

Commit Message

Martin Kaiser Oct. 29, 2022, 5:23 p.m. UTC
  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.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_mlme_ext.c    | 7 ++-----
 drivers/staging/r8188eu/include/rtw_mlme_ext.h | 2 --
 2 files changed, 2 insertions(+), 7 deletions(-)
  

Comments

kernel test robot Oct. 29, 2022, 9:29 p.m. UTC | #1
Hi Martin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]

url:    https://github.com/intel-lab-lkp/linux/commits/Martin-Kaiser/staging-r8188eu-clean-up-action-frame-handlers/20221030-012621
patch link:    https://lore.kernel.org/r/20221029172337.1574593-4-martin%40kaiser.cx
patch subject: [PATCH 03/13] staging: r8188eu: make on_action_public static void
config: powerpc-allmodconfig
compiler: powerpc-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/848beffa3ba796c4f61b74ecb8113e053372640f
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Martin-Kaiser/staging-r8188eu-clean-up-action-frame-handlers/20221030-012621
        git checkout 848beffa3ba796c4f61b74ecb8113e053372640f
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/staging/r8188eu/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/staging/r8188eu/core/rtw_mlme_ext.c: In function 'on_action_public':
>> drivers/staging/r8188eu/core/rtw_mlme_ext.c:3818:22: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
    3818 |         unsigned int ret = _FAIL;
         |                      ^~~


vim +/ret +3818 drivers/staging/r8188eu/core/rtw_mlme_ext.c

15865124feed88 Phillip Potter  2021-07-28  3814  
848beffa3ba796 Martin Kaiser   2022-10-29  3815  static void on_action_public(struct adapter *padapter, struct recv_frame *precv_frame)
15865124feed88 Phillip Potter  2021-07-28  3816  {
f603b4f936fe8d Martin Kaiser   2022-10-29  3817  	struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data;
15865124feed88 Phillip Potter  2021-07-28 @3818  	unsigned int ret = _FAIL;
15865124feed88 Phillip Potter  2021-07-28  3819  	u8 *pframe = precv_frame->rx_data;
9dc9653c8501b9 Michael Straube 2022-04-18  3820  	u8 *frame_body = pframe + sizeof(struct ieee80211_hdr_3addr);
abc1ae4a94a5fb Martin Kaiser   2022-10-29  3821  	u8 action;
15865124feed88 Phillip Potter  2021-07-28  3822  
15865124feed88 Phillip Potter  2021-07-28  3823  	/* check RA matches or not */
f603b4f936fe8d Martin Kaiser   2022-10-29  3824  	if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN))
848beffa3ba796 Martin Kaiser   2022-10-29  3825  		return;
15865124feed88 Phillip Potter  2021-07-28  3826  
15865124feed88 Phillip Potter  2021-07-28  3827  	action = frame_body[1];
15865124feed88 Phillip Potter  2021-07-28  3828  	switch (action) {
15865124feed88 Phillip Potter  2021-07-28  3829  	case ACT_PUBLIC_VENDOR:
15865124feed88 Phillip Potter  2021-07-28  3830  		ret = on_action_public_vendor(precv_frame);
15865124feed88 Phillip Potter  2021-07-28  3831  		break;
15865124feed88 Phillip Potter  2021-07-28  3832  	default:
87d544b6f4cb7b Abdun Nihaal    2022-02-09  3833  		ret = on_action_public_default(precv_frame);
15865124feed88 Phillip Potter  2021-07-28  3834  		break;
15865124feed88 Phillip Potter  2021-07-28  3835  	}
15865124feed88 Phillip Potter  2021-07-28  3836  }
15865124feed88 Phillip Potter  2021-07-28  3837
  

Patch

diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index 7d4f208d161b..caa73f16dbf9 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -3813,7 +3813,7 @@  static unsigned int on_action_public_default(struct recv_frame *precv_frame)
 	return ret;
 }
 
-unsigned int on_action_public(struct adapter *padapter, struct recv_frame *precv_frame)
+static void on_action_public(struct adapter *padapter, struct recv_frame *precv_frame)
 {
 	struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data;
 	unsigned int ret = _FAIL;
@@ -3823,7 +3823,7 @@  unsigned int on_action_public(struct adapter *padapter, struct recv_frame *precv
 
 	/* check RA matches or not */
 	if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN))
-		goto exit;
+		return;
 
 	action = frame_body[1];
 	switch (action) {
@@ -3834,9 +3834,6 @@  unsigned int on_action_public(struct adapter *padapter, struct recv_frame *precv
 		ret = on_action_public_default(precv_frame);
 		break;
 	}
-
-exit:
-	return ret;
 }
 
 unsigned int OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_frame)
diff --git a/drivers/staging/r8188eu/include/rtw_mlme_ext.h b/drivers/staging/r8188eu/include/rtw_mlme_ext.h
index c8beaa927cba..ec2e9352011b 100644
--- a/drivers/staging/r8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/r8188eu/include/rtw_mlme_ext.h
@@ -538,8 +538,6 @@  void start_create_ibss(struct adapter *padapter);
 
 unsigned int OnAction_back(struct adapter *padapter,
 			   struct recv_frame *precv_frame);
-unsigned int on_action_public(struct adapter *padapter,
-			      struct recv_frame *precv_frame);
 unsigned int OnAction_p2p(struct adapter *padapter,
 			  struct recv_frame *precv_frame);