linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/14] staging: r8188eu: cleanup unset pointers in
@ 2021-09-06  1:00 Phillip Potter
  2021-09-06  1:00 ` [PATCH 01/14] staging: r8188eu: remove rtw_hal_reset_security_engine function Phillip Potter
                   ` (13 more replies)
  0 siblings, 14 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:00 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

This series removes all remaining pointers from struct hal_ops that are
never set anywhere else in the driver. As a part of this, it also takes
out the wrapper functions and their callers, given that they mostly never
end up calling/returning the function pointer value as they check for
NULL.

There are two exceptions to this however, and therefore this series also
fixes two potentially triggerable NULL pointer dereference bugs.

Phillip Potter (14):
  staging: r8188eu: remove rtw_hal_reset_security_engine function
  staging: r8188eu: remove hal_reset_security_engine from struct hal_ops
  staging: r8188eu: remove rtw_hal_enable_interrupt function
  staging: r8188eu: remove enable_interrupt from struct hal_ops
  staging: r8188eu: remove rtw_hal_disable_interrupt function
  staging: r8188eu: remove disable_interrupt from struct hal_ops
  staging: r8188eu: remove rtw_hal_interrupt_handler function
  staging: r8188eu: remove interrupt_handler from struct hal_ops
  staging: r8188eu: remove rtw_hal_xmitframe_enqueue function
  staging: r8188eu: remove hal_xmitframe_enqueue from struct hal_ops
  staging: r8188eu: remove Efuse_PgPacketWrite_BT function
  staging: r8188eu: remove Efuse_PgPacketWrite_BT from struct hal_ops
  staging: r8188eu: remove rtw_hal_c2h_id_filter_ccx function
  staging: r8188eu: remove c2h_id_filter_ccx from struct hal_ops

 drivers/staging/r8188eu/core/rtw_cmd.c     |  9 +----
 drivers/staging/r8188eu/core/rtw_efuse.c   | 13 +------
 drivers/staging/r8188eu/core/rtw_recv.c    |  2 -
 drivers/staging/r8188eu/hal/hal_intf.c     | 44 ----------------------
 drivers/staging/r8188eu/include/hal_intf.h | 19 ----------
 5 files changed, 3 insertions(+), 84 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 01/14] staging: r8188eu: remove rtw_hal_reset_security_engine function
  2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
@ 2021-09-06  1:00 ` Phillip Potter
  2021-09-06  1:00 ` [PATCH 02/14] staging: r8188eu: remove hal_reset_security_engine from struct hal_ops Phillip Potter
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:00 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

Remove rtw_hal_reset_security_engine and its one caller from
hal/hal_intf.c, and remove its declaration from include/hal_intf.h as
well. This is just a wrapper function that calls the function pointer
hal_reset_security_engine in struct hal_ops if it is set, which it never
is.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/hal/hal_intf.c     | 8 --------
 drivers/staging/r8188eu/include/hal_intf.h | 1 -
 2 files changed, 9 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/hal_intf.c b/drivers/staging/r8188eu/hal/hal_intf.c
index bcc77da06c08..06ee8ef69ce8 100644
--- a/drivers/staging/r8188eu/hal/hal_intf.c
+++ b/drivers/staging/r8188eu/hal/hal_intf.c
@@ -81,8 +81,6 @@ uint	 rtw_hal_init(struct adapter *adapt)
 
 		if (adapt->registrypriv.notch_filter == 1)
 			rtw_hal_notch_filter(adapt, 1);
-
-		rtw_hal_reset_security_engine(adapt);
 	} else {
 		adapt->hw_init_completed = false;
 		DBG_88E("rtw_hal_init: hal__init fail\n");
@@ -420,12 +418,6 @@ void rtw_hal_notch_filter(struct adapter *adapter, bool enable)
 		adapter->HalFunc.hal_notch_filter(adapter, enable);
 }
 
-void rtw_hal_reset_security_engine(struct adapter *adapter)
-{
-	if (adapter->HalFunc.hal_reset_security_engine)
-		adapter->HalFunc.hal_reset_security_engine(adapter);
-}
-
 c2h_id_filter rtw_hal_c2h_id_filter_ccx(struct adapter *adapter)
 {
 	return adapter->HalFunc.c2h_id_filter_ccx;
diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index 5f6ef4d6333a..5612274dea4d 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -360,7 +360,6 @@ int rtw_hal_iol_cmd(struct adapter  *adapter, struct xmit_frame *xmit_frame,
 		    u32 max_wating_ms, u32 bndy_cnt);
 
 void rtw_hal_notch_filter(struct adapter *adapter, bool enable);
-void rtw_hal_reset_security_engine(struct adapter *adapter);
 
 c2h_id_filter rtw_hal_c2h_id_filter_ccx(struct adapter *adapter);
 void indicate_wx_scan_complete_event(struct adapter *padapter);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 02/14] staging: r8188eu: remove hal_reset_security_engine from struct hal_ops
  2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
  2021-09-06  1:00 ` [PATCH 01/14] staging: r8188eu: remove rtw_hal_reset_security_engine function Phillip Potter
@ 2021-09-06  1:00 ` Phillip Potter
  2021-09-06  8:25   ` Dan Carpenter
  2021-09-06  1:00 ` [PATCH 03/14] staging: r8188eu: remove rtw_hal_enable_interrupt function Phillip Potter
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:00 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

Remove hal_reset_security_engine function pointer from struct hal_ops,
as it is unused.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/include/hal_intf.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index 5612274dea4d..3cbe6c277677 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -250,7 +250,6 @@ struct hal_ops {
 				  u32 bndy_cnt);
 
 	void (*hal_notch_filter)(struct adapter *adapter, bool enable);
-	void (*hal_reset_security_engine)(struct adapter *adapter);
 	c2h_id_filter c2h_id_filter_ccx;
 };
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 03/14] staging: r8188eu: remove rtw_hal_enable_interrupt function
  2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
  2021-09-06  1:00 ` [PATCH 01/14] staging: r8188eu: remove rtw_hal_reset_security_engine function Phillip Potter
  2021-09-06  1:00 ` [PATCH 02/14] staging: r8188eu: remove hal_reset_security_engine from struct hal_ops Phillip Potter
@ 2021-09-06  1:00 ` Phillip Potter
  2021-09-06  1:00 ` [PATCH 04/14] staging: r8188eu: remove enable_interrupt from struct hal_ops Phillip Potter
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:00 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

Remove rtw_hal_enable_interrupt from hal/hal_intf.c, and remove its
declaration from include/hal_intf.h as well. This is just a wrapper
function that calls the function pointer enable_interrupt in struct
hal_ops if it is set, which it never is. In addition, this wrapper
function is unused anyway.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/hal/hal_intf.c     | 8 --------
 drivers/staging/r8188eu/include/hal_intf.h | 1 -
 2 files changed, 9 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/hal_intf.c b/drivers/staging/r8188eu/hal/hal_intf.c
index 06ee8ef69ce8..3eb05863856d 100644
--- a/drivers/staging/r8188eu/hal/hal_intf.c
+++ b/drivers/staging/r8188eu/hal/hal_intf.c
@@ -149,14 +149,6 @@ void rtw_hal_get_odm_var(struct adapter *adapt,
 						      val1, set);
 }
 
-void rtw_hal_enable_interrupt(struct adapter *adapt)
-{
-	if (adapt->HalFunc.enable_interrupt)
-		adapt->HalFunc.enable_interrupt(adapt);
-	else
-		DBG_88E("%s: HalFunc.enable_interrupt is NULL!\n", __func__);
-}
-
 void rtw_hal_disable_interrupt(struct adapter *adapt)
 {
 	if (adapt->HalFunc.disable_interrupt)
diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index 3cbe6c277677..e59a482cc139 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -298,7 +298,6 @@ void rtw_hal_get_odm_var(struct adapter *padapter,
 			 enum hal_odm_variable eVariable,
 			 void *pValue1, bool bSet);
 
-void rtw_hal_enable_interrupt(struct adapter *padapter);
 void rtw_hal_disable_interrupt(struct adapter *padapter);
 
 u32	rtw_hal_inirp_init(struct adapter *padapter);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 04/14] staging: r8188eu: remove enable_interrupt from struct hal_ops
  2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
                   ` (2 preceding siblings ...)
  2021-09-06  1:00 ` [PATCH 03/14] staging: r8188eu: remove rtw_hal_enable_interrupt function Phillip Potter
@ 2021-09-06  1:00 ` Phillip Potter
  2021-09-06  1:00 ` [PATCH 05/14] staging: r8188eu: remove rtw_hal_disable_interrupt function Phillip Potter
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:00 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

Remove enable_interrupt function pointer from struct hal_ops, as it
is unused.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/include/hal_intf.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index e59a482cc139..f4cb3727030b 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -156,7 +156,6 @@ struct hal_ops {
 
 	void	(*read_adapter_info)(struct adapter *padapter);
 
-	void	(*enable_interrupt)(struct adapter *padapter);
 	void	(*disable_interrupt)(struct adapter *padapter);
 	s32	(*interrupt_handler)(struct adapter *padapter);
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 05/14] staging: r8188eu: remove rtw_hal_disable_interrupt function
  2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
                   ` (3 preceding siblings ...)
  2021-09-06  1:00 ` [PATCH 04/14] staging: r8188eu: remove enable_interrupt from struct hal_ops Phillip Potter
@ 2021-09-06  1:00 ` Phillip Potter
  2021-09-06  1:00 ` [PATCH 06/14] staging: r8188eu: remove disable_interrupt from struct hal_ops Phillip Potter
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:00 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

Remove rtw_hal_disable_interrupt from hal/hal_intf.c, and remove its
declaration from include/hal_intf.h as well. This is just a wrapper
function that calls the function pointer disable_interrupt in struct
hal_ops if it is set, which it never is. In addition, this wrapper
function is unused anyway.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/hal/hal_intf.c     | 8 --------
 drivers/staging/r8188eu/include/hal_intf.h | 2 --
 2 files changed, 10 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/hal_intf.c b/drivers/staging/r8188eu/hal/hal_intf.c
index 3eb05863856d..79cf6df0f598 100644
--- a/drivers/staging/r8188eu/hal/hal_intf.c
+++ b/drivers/staging/r8188eu/hal/hal_intf.c
@@ -149,14 +149,6 @@ void rtw_hal_get_odm_var(struct adapter *adapt,
 						      val1, set);
 }
 
-void rtw_hal_disable_interrupt(struct adapter *adapt)
-{
-	if (adapt->HalFunc.disable_interrupt)
-		adapt->HalFunc.disable_interrupt(adapt);
-	else
-		DBG_88E("%s: HalFunc.disable_interrupt is NULL!\n", __func__);
-}
-
 u32 rtw_hal_inirp_init(struct adapter *adapt)
 {
 	u32 rst = _FAIL;
diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index f4cb3727030b..e45a45dc1ec1 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -297,8 +297,6 @@ void rtw_hal_get_odm_var(struct adapter *padapter,
 			 enum hal_odm_variable eVariable,
 			 void *pValue1, bool bSet);
 
-void rtw_hal_disable_interrupt(struct adapter *padapter);
-
 u32	rtw_hal_inirp_init(struct adapter *padapter);
 u32	rtw_hal_inirp_deinit(struct adapter *padapter);
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 06/14] staging: r8188eu: remove disable_interrupt from struct hal_ops
  2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
                   ` (4 preceding siblings ...)
  2021-09-06  1:00 ` [PATCH 05/14] staging: r8188eu: remove rtw_hal_disable_interrupt function Phillip Potter
@ 2021-09-06  1:00 ` Phillip Potter
  2021-09-06  1:00 ` [PATCH 07/14] staging: r8188eu: remove rtw_hal_interrupt_handler function Phillip Potter
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:00 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

Remove disable_interrupt function pointer from struct hal_ops, as it
is unused.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/include/hal_intf.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index e45a45dc1ec1..f3951c405927 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -156,7 +156,6 @@ struct hal_ops {
 
 	void	(*read_adapter_info)(struct adapter *padapter);
 
-	void	(*disable_interrupt)(struct adapter *padapter);
 	s32	(*interrupt_handler)(struct adapter *padapter);
 
 	void	(*set_bwmode_handler)(struct adapter *padapter,
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 07/14] staging: r8188eu: remove rtw_hal_interrupt_handler function
  2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
                   ` (5 preceding siblings ...)
  2021-09-06  1:00 ` [PATCH 06/14] staging: r8188eu: remove disable_interrupt from struct hal_ops Phillip Potter
@ 2021-09-06  1:00 ` Phillip Potter
  2021-09-06  1:01 ` [PATCH 08/14] staging: r8188eu: remove interrupt_handler from struct hal_ops Phillip Potter
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:00 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

Remove rtw_hal_interrupt_handler from hal/hal_intf.c, and remove its
declaration from include/hal_intf.h as well. This is just a wrapper
function that calls the function pointer interrupt_handler in struct
hal_ops if it is set, which it never is. In addition, this wrapper
function is unused anyway.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/hal/hal_intf.c     | 7 -------
 drivers/staging/r8188eu/include/hal_intf.h | 2 --
 2 files changed, 9 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/hal_intf.c b/drivers/staging/r8188eu/hal/hal_intf.c
index 79cf6df0f598..8b90bf4f5e58 100644
--- a/drivers/staging/r8188eu/hal/hal_intf.c
+++ b/drivers/staging/r8188eu/hal/hal_intf.c
@@ -299,13 +299,6 @@ void rtw_hal_write_rfreg(struct adapter *adapt, enum rf_radio_path rfpath,
 					      bitmask, data);
 }
 
-s32 rtw_hal_interrupt_handler(struct adapter *adapt)
-{
-	if (adapt->HalFunc.interrupt_handler)
-		return adapt->HalFunc.interrupt_handler(adapt);
-	return _FAIL;
-}
-
 void rtw_hal_set_bwmode(struct adapter *adapt,
 			enum ht_channel_width bandwidth, u8 offset)
 {
diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index f3951c405927..fa3c09e3c2f1 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -331,8 +331,6 @@ void	rtw_hal_write_rfreg(struct adapter *padapter,
 			    enum rf_radio_path eRFPath, u32 RegAddr,
 			    u32 BitMask, u32 Data);
 
-s32	rtw_hal_interrupt_handler(struct adapter *padapter);
-
 void	rtw_hal_set_bwmode(struct adapter *padapter,
 			   enum ht_channel_width Bandwidth, u8 Offset);
 void	rtw_hal_set_chan(struct adapter *padapter, u8 channel);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 08/14] staging: r8188eu: remove interrupt_handler from struct hal_ops
  2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
                   ` (6 preceding siblings ...)
  2021-09-06  1:00 ` [PATCH 07/14] staging: r8188eu: remove rtw_hal_interrupt_handler function Phillip Potter
@ 2021-09-06  1:01 ` Phillip Potter
  2021-09-06  1:01 ` [PATCH 09/14] staging: r8188eu: remove rtw_hal_xmitframe_enqueue function Phillip Potter
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:01 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

Remove interrupt_handler function pointer from struct hal_ops, as it
is unused.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/include/hal_intf.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index fa3c09e3c2f1..c4c04f929225 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -156,8 +156,6 @@ struct hal_ops {
 
 	void	(*read_adapter_info)(struct adapter *padapter);
 
-	s32	(*interrupt_handler)(struct adapter *padapter);
-
 	void	(*set_bwmode_handler)(struct adapter *padapter,
 				      enum ht_channel_width Bandwidth,
 				      u8 Offset);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 09/14] staging: r8188eu: remove rtw_hal_xmitframe_enqueue function
  2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
                   ` (7 preceding siblings ...)
  2021-09-06  1:01 ` [PATCH 08/14] staging: r8188eu: remove interrupt_handler from struct hal_ops Phillip Potter
@ 2021-09-06  1:01 ` Phillip Potter
  2021-09-06  1:01 ` [PATCH 10/14] staging: r8188eu: remove hal_xmitframe_enqueue from struct hal_ops Phillip Potter
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:01 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

Remove rtw_hal_xmitframe_enqueue from hal/hal_intf.c and its one
caller from core/rtw_recv.c, and remove its declaration from
include/hal_intf.h as well. This is just a wrapper function that calls
the function pointer hal_xmitframe_enqueue in struct hal_ops if it
is set, which it never is.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/core/rtw_recv.c    | 2 --
 drivers/staging/r8188eu/hal/hal_intf.c     | 8 --------
 drivers/staging/r8188eu/include/hal_intf.h | 2 --
 3 files changed, 12 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
index 019c5364905b..ba69cf9facfe 100644
--- a/drivers/staging/r8188eu/core/rtw_recv.c
+++ b/drivers/staging/r8188eu/core/rtw_recv.c
@@ -966,8 +966,6 @@ static int validate_recv_ctrl_frame(struct adapter *padapter,
 
 				pxmitframe->attrib.triggered = 1;
 
-				rtw_hal_xmitframe_enqueue(padapter, pxmitframe);
-
 				if (psta->sleepq_len == 0) {
 					pstapriv->tim_bitmap &= ~BIT(psta->aid);
 
diff --git a/drivers/staging/r8188eu/hal/hal_intf.c b/drivers/staging/r8188eu/hal/hal_intf.c
index 8b90bf4f5e58..b4fea82bce87 100644
--- a/drivers/staging/r8188eu/hal/hal_intf.c
+++ b/drivers/staging/r8188eu/hal/hal_intf.c
@@ -177,14 +177,6 @@ u8 rtw_hal_intf_ps_func(struct adapter *adapt,
 	return _FAIL;
 }
 
-s32 rtw_hal_xmitframe_enqueue(struct adapter *padapter,
-			      struct xmit_frame *pxmitframe)
-{
-	if (padapter->HalFunc.hal_xmitframe_enqueue)
-		return padapter->HalFunc.hal_xmitframe_enqueue(padapter, pxmitframe);
-	return false;
-}
-
 s32 rtw_hal_xmit(struct adapter *adapt, struct xmit_frame *pxmitframe)
 {
 	if (adapt->HalFunc.hal_xmit)
diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index c4c04f929225..b30968a94fbf 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -299,8 +299,6 @@ u32	rtw_hal_inirp_deinit(struct adapter *padapter);
 
 u8	rtw_hal_intf_ps_func(struct adapter *padapter,
 			     enum hal_intf_ps_func efunc_id, u8 *val);
-s32 rtw_hal_xmitframe_enqueue(struct adapter *padapter,
-			      struct xmit_frame *pxmitframe);
 
 s32	rtw_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe);
 s32	rtw_hal_mgnt_xmit(struct adapter *padapter,
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 10/14] staging: r8188eu: remove hal_xmitframe_enqueue from struct hal_ops
  2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
                   ` (8 preceding siblings ...)
  2021-09-06  1:01 ` [PATCH 09/14] staging: r8188eu: remove rtw_hal_xmitframe_enqueue function Phillip Potter
@ 2021-09-06  1:01 ` Phillip Potter
  2021-09-06  1:01 ` [PATCH 11/14] staging: r8188eu: remove Efuse_PgPacketWrite_BT function Phillip Potter
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:01 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

Remove hal_xmitframe_enqueue function pointer from struct hal_ops, as it
is unused.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/include/hal_intf.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index b30968a94fbf..b47fcdcf2027 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -202,8 +202,6 @@ struct hal_ops {
 			    struct xmit_frame *pxmitframe);
 	s32 (*mgnt_xmit)(struct adapter *padapter,
 			 struct xmit_frame *pmgntframe);
-	s32 (*hal_xmitframe_enqueue)(struct adapter *padapter,
-				     struct xmit_frame *pxmitframe);
 
 	u32	(*read_bbreg)(struct adapter *padapter, u32 RegAddr,
 			      u32 BitMask);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 11/14] staging: r8188eu: remove Efuse_PgPacketWrite_BT function
  2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
                   ` (9 preceding siblings ...)
  2021-09-06  1:01 ` [PATCH 10/14] staging: r8188eu: remove hal_xmitframe_enqueue from struct hal_ops Phillip Potter
@ 2021-09-06  1:01 ` Phillip Potter
  2021-09-06  1:01 ` [PATCH 12/14] staging: r8188eu: remove Efuse_PgPacketWrite_BT from struct hal_ops Phillip Potter
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:01 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

Remove static Efuse_PgPacketWrite_BT and its one caller from
core/rtw_efuse.c. This function is a wrapper function which calls
the Efuse_PgPacketWrite_BT function pointer of struct hal_ops
unconditionally. As this function pointer is never set, and this
function call is possible to reach, this could lead to an attempt to
deference a NULL pointer, which would crash the driver.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/core/rtw_efuse.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_efuse.c b/drivers/staging/r8188eu/core/rtw_efuse.c
index c1c70648f5bc..e1a9c031435b 100644
--- a/drivers/staging/r8188eu/core/rtw_efuse.c
+++ b/drivers/staging/r8188eu/core/rtw_efuse.c
@@ -351,15 +351,6 @@ int Efuse_PgPacketWrite(struct adapter *pAdapter, u8 offset, u8 word_en, u8 *dat
 	return ret;
 }
 
-static int Efuse_PgPacketWrite_BT(struct adapter *pAdapter, u8 offset, u8 word_en, u8 *data, bool pseudo)
-{
-	int ret;
-
-	ret =  pAdapter->HalFunc.Efuse_PgPacketWrite_BT(pAdapter, offset, word_en, data, pseudo);
-
-	return ret;
-}
-
 /*-----------------------------------------------------------------------------
  * Function:	efuse_WordEnableDataRead
  *
@@ -676,9 +667,7 @@ u8 rtw_BT_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data
 				DBG_88E("0x%02X ", newdata[i]);
 			DBG_88E("\n");
 
-			ret = Efuse_PgPacketWrite_BT(padapter, offset, word_en, newdata, false);
-			if (ret == _FAIL)
-				break;
+			break;
 		}
 
 		if (idx == cnts)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 12/14] staging: r8188eu: remove Efuse_PgPacketWrite_BT from struct hal_ops
  2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
                   ` (10 preceding siblings ...)
  2021-09-06  1:01 ` [PATCH 11/14] staging: r8188eu: remove Efuse_PgPacketWrite_BT function Phillip Potter
@ 2021-09-06  1:01 ` Phillip Potter
  2021-09-06  1:01 ` [PATCH 13/14] staging: r8188eu: remove rtw_hal_c2h_id_filter_ccx function Phillip Potter
  2021-09-06  1:01 ` [PATCH 14/14] staging: r8188eu: remove c2h_id_filter_ccx from struct hal_ops Phillip Potter
  13 siblings, 0 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:01 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

Remove Efuse_PgPacketWrite_BT function pointer from struct hal_ops, as it
is unused.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/include/hal_intf.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index b47fcdcf2027..002bcb338cab 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -229,8 +229,6 @@ struct hal_ops {
 	u8	(*Efuse_WordEnableDataWrite)(struct adapter *padapter,
 					     u16 efuse_addr, u8 word_en,
 					     u8 *data, bool bPseudoTest);
-	bool	(*Efuse_PgPacketWrite_BT)(struct adapter *padapter, u8 offset,
-					  u8 word_en, u8 *data, bool test);
 
 	void (*sreset_init_value)(struct adapter *padapter);
 	void (*sreset_reset_value)(struct adapter *padapter);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 13/14] staging: r8188eu: remove rtw_hal_c2h_id_filter_ccx function
  2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
                   ` (11 preceding siblings ...)
  2021-09-06  1:01 ` [PATCH 12/14] staging: r8188eu: remove Efuse_PgPacketWrite_BT from struct hal_ops Phillip Potter
@ 2021-09-06  1:01 ` Phillip Potter
  2021-09-06  1:01 ` [PATCH 14/14] staging: r8188eu: remove c2h_id_filter_ccx from struct hal_ops Phillip Potter
  13 siblings, 0 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:01 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

Remove rtw_hal_c2h_id_filter_ccx from hal/hal_intf.c and its one caller
from core/rtw_cmd.c. This function is a wrapper function which returns
the c2h_id_filter_ccx function pointer of struct hal_ops unconditionally.
As this function pointer is never set, and the function call's return
value is subsequently called inside an if condition, this could lead to
an attempt to deference a NULL pointer, which would crash the driver.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/core/rtw_cmd.c     | 9 ++-------
 drivers/staging/r8188eu/hal/hal_intf.c     | 5 -----
 drivers/staging/r8188eu/include/hal_intf.h | 1 -
 3 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index fee4208dacba..738e1ec749be 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -1865,7 +1865,6 @@ static void c2h_wk_callback(struct work_struct *work)
 	struct evt_priv *evtpriv = container_of(work, struct evt_priv, c2h_wk);
 	struct adapter *adapter = container_of(evtpriv, struct adapter, evtpriv);
 	struct c2h_evt_hdr *c2h_evt;
-	c2h_id_filter ccx_id_filter = rtw_hal_c2h_id_filter_ccx(adapter);
 
 	evtpriv->c2h_wk_alive = true;
 
@@ -1895,14 +1894,10 @@ static void c2h_wk_callback(struct work_struct *work)
 			continue;
 		}
 
-		if (ccx_id_filter(c2h_evt->id)) {
-			kfree(c2h_evt);
-		} else {
 #ifdef CONFIG_88EU_P2P
-			/* Enqueue into cmd_thread for others */
-			rtw_c2h_wk_cmd(adapter, (u8 *)c2h_evt);
+		/* Enqueue into cmd_thread for others */
+		rtw_c2h_wk_cmd(adapter, (u8 *)c2h_evt);
 #endif
-		}
 	}
 
 	evtpriv->c2h_wk_alive = false;
diff --git a/drivers/staging/r8188eu/hal/hal_intf.c b/drivers/staging/r8188eu/hal/hal_intf.c
index b4fea82bce87..ac4bbaecf8b0 100644
--- a/drivers/staging/r8188eu/hal/hal_intf.c
+++ b/drivers/staging/r8188eu/hal/hal_intf.c
@@ -386,8 +386,3 @@ void rtw_hal_notch_filter(struct adapter *adapter, bool enable)
 	if (adapter->HalFunc.hal_notch_filter)
 		adapter->HalFunc.hal_notch_filter(adapter, enable);
 }
-
-c2h_id_filter rtw_hal_c2h_id_filter_ccx(struct adapter *adapter)
-{
-	return adapter->HalFunc.c2h_id_filter_ccx;
-}
diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index 002bcb338cab..6deecbbc284d 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -345,7 +345,6 @@ int rtw_hal_iol_cmd(struct adapter  *adapter, struct xmit_frame *xmit_frame,
 
 void rtw_hal_notch_filter(struct adapter *adapter, bool enable);
 
-c2h_id_filter rtw_hal_c2h_id_filter_ccx(struct adapter *adapter);
 void indicate_wx_scan_complete_event(struct adapter *padapter);
 u8 rtw_do_join(struct adapter *padapter);
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 14/14] staging: r8188eu: remove c2h_id_filter_ccx from struct hal_ops
  2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
                   ` (12 preceding siblings ...)
  2021-09-06  1:01 ` [PATCH 13/14] staging: r8188eu: remove rtw_hal_c2h_id_filter_ccx function Phillip Potter
@ 2021-09-06  1:01 ` Phillip Potter
  13 siblings, 0 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06  1:01 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, straube.linux, linux-kernel, linux-staging

Remove c2h_id_filter_ccx function pointer from struct hal_ops, as it
is unused.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/include/hal_intf.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index 6deecbbc284d..efc2d9955efb 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -242,7 +242,6 @@ struct hal_ops {
 				  u32 bndy_cnt);
 
 	void (*hal_notch_filter)(struct adapter *adapter, bool enable);
-	c2h_id_filter c2h_id_filter_ccx;
 };
 
 #define RF_CHANGE_BY_INIT	0
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 02/14] staging: r8188eu: remove hal_reset_security_engine from struct hal_ops
  2021-09-06  1:00 ` [PATCH 02/14] staging: r8188eu: remove hal_reset_security_engine from struct hal_ops Phillip Potter
@ 2021-09-06  8:25   ` Dan Carpenter
  2021-09-06 23:05     ` Phillip Potter
  0 siblings, 1 reply; 17+ messages in thread
From: Dan Carpenter @ 2021-09-06  8:25 UTC (permalink / raw)
  To: Phillip Potter
  Cc: gregkh, Larry.Finger, straube.linux, linux-kernel, linux-staging

On Mon, Sep 06, 2021 at 02:00:54AM +0100, Phillip Potter wrote:
> Remove hal_reset_security_engine function pointer from struct hal_ops,
> as it is unused.
> 
> Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> ---
>  drivers/staging/r8188eu/include/hal_intf.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
> index 5612274dea4d..3cbe6c277677 100644
> --- a/drivers/staging/r8188eu/include/hal_intf.h
> +++ b/drivers/staging/r8188eu/include/hal_intf.h
> @@ -250,7 +250,6 @@ struct hal_ops {
>  				  u32 bndy_cnt);
>  
>  	void (*hal_notch_filter)(struct adapter *adapter, bool enable);
> -	void (*hal_reset_security_engine)(struct adapter *adapter);
>  	c2h_id_filter c2h_id_filter_ccx;
>  };

I love these patchsets which are removing the HAL layer, but it would
be better if you folded patches 1 and 2 together because it would be
easier to review.  That way we can just say "Well, if this patch isn't
correct it will cause a compile error so let's assume it's correct
unless the kbuild-bot complains."

There are other pairs in this patchset which are the same way where they
would be easier to review if they were merged. 3 & 4.  5 & 6.  Etc.

The patcheset is fine but for future reference please fold them together.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 02/14] staging: r8188eu: remove hal_reset_security_engine from struct hal_ops
  2021-09-06  8:25   ` Dan Carpenter
@ 2021-09-06 23:05     ` Phillip Potter
  0 siblings, 0 replies; 17+ messages in thread
From: Phillip Potter @ 2021-09-06 23:05 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Greg KH, Larry Finger, Michael Straube,
	Linux Kernel Mailing List, open list:STAGING SUBSYSTEM

On Mon, 6 Sept 2021 at 09:26, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> On Mon, Sep 06, 2021 at 02:00:54AM +0100, Phillip Potter wrote:
> > Remove hal_reset_security_engine function pointer from struct hal_ops,
> > as it is unused.
> >
> > Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> > ---
> >  drivers/staging/r8188eu/include/hal_intf.h | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
> > index 5612274dea4d..3cbe6c277677 100644
> > --- a/drivers/staging/r8188eu/include/hal_intf.h
> > +++ b/drivers/staging/r8188eu/include/hal_intf.h
> > @@ -250,7 +250,6 @@ struct hal_ops {
> >                                 u32 bndy_cnt);
> >
> >       void (*hal_notch_filter)(struct adapter *adapter, bool enable);
> > -     void (*hal_reset_security_engine)(struct adapter *adapter);
> >       c2h_id_filter c2h_id_filter_ccx;
> >  };
>
> I love these patchsets which are removing the HAL layer, but it would
> be better if you folded patches 1 and 2 together because it would be
> easier to review.  That way we can just say "Well, if this patch isn't
> correct it will cause a compile error so let's assume it's correct
> unless the kbuild-bot complains."
>
> There are other pairs in this patchset which are the same way where they
> would be easier to review if they were merged. 3 & 4.  5 & 6.  Etc.
>
> The patcheset is fine but for future reference please fold them together.
>
> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> regards,
> dan carpenter
>

Dear Dan,

Thank you for the review, much appreciated. I will endeavour to do
this in future.

Regards,
Phil

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-09-06 23:05 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
2021-09-06  1:00 ` [PATCH 01/14] staging: r8188eu: remove rtw_hal_reset_security_engine function Phillip Potter
2021-09-06  1:00 ` [PATCH 02/14] staging: r8188eu: remove hal_reset_security_engine from struct hal_ops Phillip Potter
2021-09-06  8:25   ` Dan Carpenter
2021-09-06 23:05     ` Phillip Potter
2021-09-06  1:00 ` [PATCH 03/14] staging: r8188eu: remove rtw_hal_enable_interrupt function Phillip Potter
2021-09-06  1:00 ` [PATCH 04/14] staging: r8188eu: remove enable_interrupt from struct hal_ops Phillip Potter
2021-09-06  1:00 ` [PATCH 05/14] staging: r8188eu: remove rtw_hal_disable_interrupt function Phillip Potter
2021-09-06  1:00 ` [PATCH 06/14] staging: r8188eu: remove disable_interrupt from struct hal_ops Phillip Potter
2021-09-06  1:00 ` [PATCH 07/14] staging: r8188eu: remove rtw_hal_interrupt_handler function Phillip Potter
2021-09-06  1:01 ` [PATCH 08/14] staging: r8188eu: remove interrupt_handler from struct hal_ops Phillip Potter
2021-09-06  1:01 ` [PATCH 09/14] staging: r8188eu: remove rtw_hal_xmitframe_enqueue function Phillip Potter
2021-09-06  1:01 ` [PATCH 10/14] staging: r8188eu: remove hal_xmitframe_enqueue from struct hal_ops Phillip Potter
2021-09-06  1:01 ` [PATCH 11/14] staging: r8188eu: remove Efuse_PgPacketWrite_BT function Phillip Potter
2021-09-06  1:01 ` [PATCH 12/14] staging: r8188eu: remove Efuse_PgPacketWrite_BT from struct hal_ops Phillip Potter
2021-09-06  1:01 ` [PATCH 13/14] staging: r8188eu: remove rtw_hal_c2h_id_filter_ccx function Phillip Potter
2021-09-06  1:01 ` [PATCH 14/14] staging: r8188eu: remove c2h_id_filter_ccx from struct hal_ops Phillip Potter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).