2019-03-20 14:30:49

by Ivan Safonov

[permalink] [raw]
Subject: [PATCH] staging: r8188eu: refactor recvframe_defrag()

Local variables pfhdr and prframe always have a same value,
so one of them is unnecessary.

Signed-off-by: Ivan Safonov <[email protected]>
---
drivers/staging/rtl8188eu/core/rtw_recv.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 90eb1a025051..9075e3a2755a 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -1325,7 +1325,7 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter,
struct list_head *plist, *phead;
u8 wlanhdr_offset;
u8 curfragnum;
- struct recv_frame *pfhdr, *pnfhdr;
+ struct recv_frame *pnfhdr;
struct recv_frame *prframe, *pnextrframe;
struct __queue *pfree_recv_queue;

@@ -1334,11 +1334,10 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter,

phead = get_list_head(defrag_q);
plist = phead->next;
- pfhdr = list_entry(plist, struct recv_frame, list);
- prframe = pfhdr;
+ prframe = list_entry(plist, struct recv_frame, list);
list_del_init(&prframe->list);

- if (curfragnum != pfhdr->attrib.frag_num) {
+ if (curfragnum != prframe->attrib.frag_num) {
/* the first fragment number must be 0 */
/* free the whole queue */
rtw_free_recvframe(prframe, pfree_recv_queue);
@@ -1377,15 +1376,15 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter,
skb_pull(pnextrframe->pkt, wlanhdr_offset);

/* append to first fragment frame's tail (if privacy frame, pull the ICV) */
- skb_trim(prframe->pkt, prframe->pkt->len - pfhdr->attrib.icv_len);
+ skb_trim(prframe->pkt, prframe->pkt->len - prframe->attrib.icv_len);

/* memcpy */
- memcpy(skb_tail_pointer(pfhdr->pkt), pnfhdr->pkt->data,
+ memcpy(skb_tail_pointer(prframe->pkt), pnfhdr->pkt->data,
pnfhdr->pkt->len);

skb_put(prframe->pkt, pnfhdr->pkt->len);

- pfhdr->attrib.icv_len = pnfhdr->attrib.icv_len;
+ prframe->attrib.icv_len = pnfhdr->attrib.icv_len;
plist = plist->next;
}

--
2.19.2



2019-03-20 19:49:15

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH] staging: r8188eu: refactor recvframe_defrag()

Hi,

On 20-03-19 15:31, Ivan Safonov wrote:
> Local variables pfhdr and prframe always have a same value,
> so one of them is unnecessary.
>
> Signed-off-by: Ivan Safonov <[email protected]>

Patch look good to me:

Reviewed-by: Hans de Goede <[email protected]>

Regards,

Hans



> ---
> drivers/staging/rtl8188eu/core/rtw_recv.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c
> index 90eb1a025051..9075e3a2755a 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_recv.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
> @@ -1325,7 +1325,7 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter,
> struct list_head *plist, *phead;
> u8 wlanhdr_offset;
> u8 curfragnum;
> - struct recv_frame *pfhdr, *pnfhdr;
> + struct recv_frame *pnfhdr;
> struct recv_frame *prframe, *pnextrframe;
> struct __queue *pfree_recv_queue;
>
> @@ -1334,11 +1334,10 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter,
>
> phead = get_list_head(defrag_q);
> plist = phead->next;
> - pfhdr = list_entry(plist, struct recv_frame, list);
> - prframe = pfhdr;
> + prframe = list_entry(plist, struct recv_frame, list);
> list_del_init(&prframe->list);
>
> - if (curfragnum != pfhdr->attrib.frag_num) {
> + if (curfragnum != prframe->attrib.frag_num) {
> /* the first fragment number must be 0 */
> /* free the whole queue */
> rtw_free_recvframe(prframe, pfree_recv_queue);
> @@ -1377,15 +1376,15 @@ static struct recv_frame *recvframe_defrag(struct adapter *adapter,
> skb_pull(pnextrframe->pkt, wlanhdr_offset);
>
> /* append to first fragment frame's tail (if privacy frame, pull the ICV) */
> - skb_trim(prframe->pkt, prframe->pkt->len - pfhdr->attrib.icv_len);
> + skb_trim(prframe->pkt, prframe->pkt->len - prframe->attrib.icv_len);
>
> /* memcpy */
> - memcpy(skb_tail_pointer(pfhdr->pkt), pnfhdr->pkt->data,
> + memcpy(skb_tail_pointer(prframe->pkt), pnfhdr->pkt->data,
> pnfhdr->pkt->len);
>
> skb_put(prframe->pkt, pnfhdr->pkt->len);
>
> - pfhdr->attrib.icv_len = pnfhdr->attrib.icv_len;
> + prframe->attrib.icv_len = pnfhdr->attrib.icv_len;
> plist = plist->next;
> }
>
>