Re: [PATCH -next] staging: r8188eu: Use skb_put_data() instead of skb_put/memcpy pair

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 27, 2022 at 10:40:50AM +0800, Shang XiaoJing wrote:
> Use skb_put_data() instead of skb_put() and memcpy(), which is shorter
> and clear. Drop the tmp variable that is not needed any more.
> 
> Signed-off-by: Shang XiaoJing <shangxiaojing@xxxxxxxxxx>
> ---
>  drivers/staging/r8188eu/core/rtw_recv.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
> index 353c7468367a..44f92ce63440 100644
> --- a/drivers/staging/r8188eu/core/rtw_recv.c
> +++ b/drivers/staging/r8188eu/core/rtw_recv.c
> @@ -1412,7 +1412,6 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe)
>  	u8	nr_subframes, i;
>  	unsigned char *pdata;
>  	struct rx_pkt_attrib *pattrib;
> -	unsigned char *data_ptr;
>  	struct sk_buff *sub_skb, *subframes[MAX_SUBFRAME_COUNT];
>  
>  	struct recv_priv *precvpriv = &padapter->recvpriv;
> @@ -1447,8 +1446,7 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe)
>  		sub_skb = dev_alloc_skb(nSubframe_Length + 12);
>  		if (sub_skb) {
>  			skb_reserve(sub_skb, 12);
> -			data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length);
> -			memcpy(data_ptr, pdata, nSubframe_Length);
> +			skb_put_data(sub_skb, pdata, nSubframe_Length);
>  		} else {
>  			sub_skb = skb_clone(prframe->pkt, GFP_ATOMIC);
>  			if (sub_skb) {
> -- 
> 2.17.1
>
Tested-by: Philipp Hortmann <philipp.g.hortmann@xxxxxxxxx> # Edimax N150




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux