Commit bab735aa authored by Yihao Han's avatar Yihao Han Committed by Greg Kroah-Hartman
Browse files

staging: rtl8723bs: tidy up error handling



The check for if rtw_skb_alloc() fails is done twice and is written
in a confusing way.  Move the "if (!recvbuf->pskb)" right after
the allocation.  The "if (recvbuf->pskb)" check can now be deleted
and the code pulled in one tab.

Suggested-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarYihao Han <hanyihao@vivo.com>
Link: https://lore.kernel.org/r/20220408144442.17611-1-hanyihao@vivo.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 908662dc
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -811,8 +811,9 @@ static struct recv_buf *sd_recv_rxfifo(struct adapter *adapter, u32 size)
		SIZE_PTR alignment = 0;

		recvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
		if (!recvbuf->pskb)
			return NULL;

		if (recvbuf->pskb) {
		recvbuf->pskb->dev = adapter->pnetdev;

		tmpaddr = (SIZE_PTR)recvbuf->pskb->data;
@@ -820,10 +821,6 @@ static struct recv_buf *sd_recv_rxfifo(struct adapter *adapter, u32 size)
		skb_reserve(recvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment));
	}

		if (!recvbuf->pskb)
			return NULL;
	}

	/* 3 3. read data from rxfifo */
	readbuf = recvbuf->pskb->data;
	ret = sdio_read_port(&adapter->iopriv.intf, WLAN_RX0FF_DEVICE_ID, readsize, readbuf);