[OPW,kernel,Resend] staging: rtl8712: Remove useless cast on void pointer
diff mbox

Message ID 20141031161742.GA20438@kt-Inspiron-3542
State New, archived
Headers show

Commit Message

Tapasweni Pathak Oct. 31, 2014, 4:17 p.m. UTC
void pointers do not need to be cast to other pointer types.

The semantic patch used to find this:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Build tested it.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
---
Refresh and Resend.

 drivers/staging/rtl8712/mlme_linux.c       |   10 +++++-----
 drivers/staging/rtl8712/rtl8712_cmd.c      |    2 +-
 drivers/staging/rtl8712/rtl8712_recv.c     |   10 +++++-----
 drivers/staging/rtl8712/rtl871x_pwrctrl.c  |    2 +-
 drivers/staging/rtl8712/rtl871x_security.c |    2 +-
 drivers/staging/rtl8712/usb_ops_linux.c    |    2 +-
 6 files changed, 14 insertions(+), 14 deletions(-)

--
1.7.9.5

Comments

Greg KH Nov. 4, 2014, 12:11 a.m. UTC | #1
On Fri, Oct 31, 2014 at 09:47:42PM +0530, Tapasweni Pathak wrote:
> void pointers do not need to be cast to other pointer types.
> 
> The semantic patch used to find this:
> 
> @r@
> expression x;
> void* e;
> type T;
> identifier f;
> @@
> 
> (
>   *((T *)e)
> |
>   ((T *)x)[...]
> |
>   ((T *)x)->f
> |
> - (T *)
>   e
> )
> 
> Build tested it.
> 
> Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
> ---
> Refresh and Resend.

Still doesn't apply :(

Patch
diff mbox

diff --git a/drivers/staging/rtl8712/mlme_linux.c b/drivers/staging/rtl8712/mlme_linux.c
index 354bd03..565dcad 100644
--- a/drivers/staging/rtl8712/mlme_linux.c
+++ b/drivers/staging/rtl8712/mlme_linux.c
@@ -34,7 +34,7 @@ 

 static void sitesurvey_ctrl_handler(void *FunctionContext)
 {
-	struct _adapter *adapter = (struct _adapter *)FunctionContext;
+	struct _adapter *adapter = FunctionContext;

 	_r8712_sitesurvey_ctrl_handler(adapter);
 	_set_timer(&adapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer,
@@ -43,28 +43,28 @@  static void sitesurvey_ctrl_handler(void *FunctionContext)

 static void join_timeout_handler (void *FunctionContext)
 {
-	struct _adapter *adapter = (struct _adapter *)FunctionContext;
+	struct _adapter *adapter = FunctionContext;

 	_r8712_join_timeout_handler(adapter);
 }

 static void _scan_timeout_handler (void *FunctionContext)
 {
-	struct _adapter *adapter = (struct _adapter *)FunctionContext;
+	struct _adapter *adapter = FunctionContext;

 	r8712_scan_timeout_handler(adapter);
 }

 static void dhcp_timeout_handler (void *FunctionContext)
 {
-	struct _adapter *adapter = (struct _adapter *)FunctionContext;
+	struct _adapter *adapter = FunctionContext;

 	_r8712_dhcp_timeout_handler(adapter);
 }

 static void wdg_timeout_handler (void *FunctionContext)
 {
-	struct _adapter *adapter = (struct _adapter *)FunctionContext;
+	struct _adapter *adapter = FunctionContext;

 	_r8712_wdg_timeout_handler(adapter);

diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c b/drivers/staging/rtl8712/rtl8712_cmd.c
index 720e8a1..afa2e84 100644
--- a/drivers/staging/rtl8712/rtl8712_cmd.c
+++ b/drivers/staging/rtl8712/rtl8712_cmd.c
@@ -323,7 +323,7 @@  int r8712_cmd_thread(void *context)
 	unsigned int cmdsz, wr_sz, *pcmdbuf, *prspbuf;
 	struct tx_desc *pdesc;
 	void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd);
-	struct _adapter *padapter = (struct _adapter *)context;
+	struct _adapter *padapter = context;
 	struct	cmd_priv	*pcmdpriv = &(padapter->cmdpriv);

 	allow_signal(SIGTERM);
diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index b278062..6a02f37 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -440,10 +440,10 @@  void r8712_rxcmd_event_hdl(struct _adapter *padapter, void *prxcmdbuf)
 	u8 eid, cmd_seq;
 	struct recv_stat *prxstat;

-	poffset = (u8 *)prxcmdbuf;
+	poffset = prxcmdbuf;
 	voffset = *(uint *)poffset;
 	pkt_len = le32_to_cpu(voffset) & 0x00003fff;
-	prxstat = (struct recv_stat *)prxcmdbuf;
+	prxstat = prxcmdbuf;
 	drvinfo_sz = ((le32_to_cpu(prxstat->rxdw0) & 0x000f0000) >> 16);
 	drvinfo_sz = drvinfo_sz << 3;
 	poffset += RXDESC_SIZE + drvinfo_sz;
@@ -633,7 +633,7 @@  void r8712_reordering_ctrl_timeout_handler(void *pcontext)
 {
 	unsigned long irql;
 	struct recv_reorder_ctrl *preorder_ctrl =
-				 (struct recv_reorder_ctrl *)pcontext;
+				 pcontext;
 	struct _adapter *padapter = preorder_ctrl->padapter;
 	struct  __queue *ppending_recvframe_queue =
 				 &preorder_ctrl->pending_recvframe_queue;
@@ -971,7 +971,7 @@  int recv_func(struct _adapter *padapter, void *pcontext)
 	struct  __queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue;
 	struct	mlme_priv	*pmlmepriv = &padapter->mlmepriv;

-	prframe = (union recv_frame *)pcontext;
+	prframe = pcontext;
 	orig_prframe = prframe;
 	pattrib = &prframe->u.hdr.attrib;
 	if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) {
@@ -1114,7 +1114,7 @@  _exit_recvbuf2recvframe:
 static void recv_tasklet(void *priv)
 {
 	struct sk_buff *pskb;
-	struct _adapter *padapter = (struct _adapter *)priv;
+	struct _adapter *padapter = priv;
 	struct recv_priv *precvpriv = &padapter->recvpriv;

 	while (NULL != (pskb = skb_dequeue(&precvpriv->rx_skb_queue))) {
diff --git a/drivers/staging/rtl8712/rtl871x_pwrctrl.c b/drivers/staging/rtl8712/rtl871x_pwrctrl.c
index 51dcf55..948741e 100644
--- a/drivers/staging/rtl8712/rtl871x_pwrctrl.c
+++ b/drivers/staging/rtl8712/rtl871x_pwrctrl.c
@@ -169,7 +169,7 @@  static void rpwm_workitem_callback(struct work_struct *work)

 static void rpwm_check_handler (void *FunctionContext)
 {
-	struct _adapter *adapter = (struct _adapter *)FunctionContext;
+	struct _adapter *adapter = FunctionContext;

 	_rpwm_check_handler(adapter);
 }
diff --git a/drivers/staging/rtl8712/rtl871x_security.c b/drivers/staging/rtl8712/rtl871x_security.c
index 8faf22b..1415807 100644
--- a/drivers/staging/rtl8712/rtl871x_security.c
+++ b/drivers/staging/rtl8712/rtl871x_security.c
@@ -1400,7 +1400,7 @@  u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe)

 void r8712_use_tkipkey_handler(void *FunctionContext)
 {
-	struct _adapter *padapter = (struct _adapter *)FunctionContext;
+	struct _adapter *padapter = FunctionContext;

 	padapter->securitypriv.busetkipkey = true;
 }
diff --git a/drivers/staging/rtl8712/usb_ops_linux.c b/drivers/staging/rtl8712/usb_ops_linux.c
index e0a155a..5c7200a 100644
--- a/drivers/staging/rtl8712/usb_ops_linux.c
+++ b/drivers/staging/rtl8712/usb_ops_linux.c
@@ -328,7 +328,7 @@  void r8712_usb_read_port_cancel(struct _adapter *padapter)
 void r8712_xmit_bh(void *priv)
 {
 	int ret = false;
-	struct _adapter *padapter = (struct _adapter *)priv;
+	struct _adapter *padapter = priv;
 	struct xmit_priv *pxmitpriv = &padapter->xmitpriv;

 	if ((padapter->bDriverStopped == true) ||