From bab735aa5a49964e8b1ed337db9691e37b2ca821 Mon Sep 17 00:00:00 2001 From: Yihao Han Date: Fri, 8 Apr 2022 07:44:40 -0700 Subject: [PATCH] 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: Dan Carpenter Reviewed-by: Dan Carpenter Signed-off-by: Yihao Han Link: https://lore.kernel.org/r/20220408144442.17611-1-hanyihao@vivo.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/sdio_ops.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c index a545832a468e..107f427ee4aa 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c @@ -811,17 +811,14 @@ 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) { - recvbuf->pskb->dev = adapter->pnetdev; - - tmpaddr = (SIZE_PTR)recvbuf->pskb->data; - alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1); - skb_reserve(recvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment)); - } - if (!recvbuf->pskb) return NULL; + + recvbuf->pskb->dev = adapter->pnetdev; + + tmpaddr = (SIZE_PTR)recvbuf->pskb->data; + alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1); + skb_reserve(recvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment)); } /* 3 3. read data from rxfifo */ -- 2.20.1