Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1591461 > unrolled thread

[PATCH 5/5] staging: rtl8712: Remove unnecessary cast on void pointer

Started bysimran singhal <singhalsimran0@gmail.com>
First post2017-03-02 22:20 +0100
Last post2017-03-03 00:00 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 5/5] staging: rtl8712: Remove unnecessary cast on void pointer simran singhal <singhalsimran0@gmail.com> - 2017-03-02 22:20 +0100
    Re: [Outreachy kernel] [PATCH 5/5] staging: rtl8712: Remove unnecessary  cast on void pointer Julia Lawall <julia.lawall@lip6.fr> - 2017-03-02 23:10 +0100
      Re: [Outreachy kernel] [PATCH 5/5] staging: rtl8712: Remove  unnecessary cast on void pointer SIMRAN SINGHAL <singhalsimran0@gmail.com> - 2017-03-03 00:00 +0100

#1591461 — [PATCH 5/5] staging: rtl8712: Remove unnecessary cast on void pointer

Fromsimran singhal <singhalsimran0@gmail.com>
Date2017-03-02 22:20 +0100
Subject[PATCH 5/5] staging: rtl8712: Remove unnecessary cast on void pointer
Message-ID<tgGiK-80q-3@gated-at.bofh.it>
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
 drivers/staging/rtl8712/rtl8712_recv.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index 20fe45a..4367c68 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -444,9 +444,9 @@ void r8712_rxcmd_event_hdl(struct _adapter *padapter, void *prxcmdbuf)
 	u16 cmd_len, drvinfo_sz;
 	struct recv_stat *prxstat;
 
-	poffset = (u8 *)prxcmdbuf;
+	poffset = prxcmdbuf;
 	voffset = *(__le32 *)poffset;
-	prxstat = (struct recv_stat *)prxcmdbuf;
+	prxstat = prxcmdbuf;
 	drvinfo_sz = (le32_to_cpu(prxstat->rxdw0) & 0x000f0000) >> 16;
 	drvinfo_sz <<= 3;
 	poffset += RXDESC_SIZE + drvinfo_sz;
@@ -635,7 +635,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;
@@ -976,7 +976,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)) {
@@ -1124,7 +1124,7 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb)
 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))) {
-- 
2.7.4

[toc] | [next] | [standalone]


#1591500 — Re: [Outreachy kernel] [PATCH 5/5] staging: rtl8712: Remove unnecessary cast on void pointer

FromJulia Lawall <julia.lawall@lip6.fr>
Date2017-03-02 23:10 +0100
SubjectRe: [Outreachy kernel] [PATCH 5/5] staging: rtl8712: Remove unnecessary cast on void pointer
Message-ID<tgH57-85-5@gated-at.bofh.it>
In reply to#1591461
> @@ -635,7 +635,7 @@ void r8712_reordering_ctrl_timeout_handler(void *pcontext)
>  {
>  	unsigned long irql;
>  	struct recv_reorder_ctrl *preorder_ctrl =
> -				 (struct recv_reorder_ctrl *)pcontext;
> +				 pcontext;

Coccinelle doesn't always generate code in the best way.  pcontext can be
moved up to the previous line in this case.

julia

[toc] | [prev] | [next] | [standalone]


#1591534 — Re: [Outreachy kernel] [PATCH 5/5] staging: rtl8712: Remove unnecessary cast on void pointer

FromSIMRAN SINGHAL <singhalsimran0@gmail.com>
Date2017-03-03 00:00 +0100
SubjectRe: [Outreachy kernel] [PATCH 5/5] staging: rtl8712: Remove unnecessary cast on void pointer
Message-ID<tgHRw-ro-19@gated-at.bofh.it>
In reply to#1591500
On Fri, Mar 3, 2017 at 3:26 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> @@ -635,7 +635,7 @@ void r8712_reordering_ctrl_timeout_handler(void *pcontext)
>>  {
>>       unsigned long irql;
>>       struct recv_reorder_ctrl *preorder_ctrl =
>> -                              (struct recv_reorder_ctrl *)pcontext;
>> +                              pcontext;
>
> Coccinelle doesn't always generate code in the best way.  pcontext can be
> moved up to the previous line in this case.
>
Thanks,
I will send v2.
> julia

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web