Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <dan.carpenter@oracle.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yihao Han <hanyihao@vivo.com>
Link: https://lore.kernel.org/r/20220408144442.17611-1-hanyihao@vivo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Yihao Han and committed by
Greg Kroah-Hartman
bab735aa 908662dc

+6 -9
+6 -9
drivers/staging/rtl8723bs/hal/sdio_ops.c
··· 811 811 SIZE_PTR alignment = 0; 812 812 813 813 recvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); 814 - 815 - if (recvbuf->pskb) { 816 - recvbuf->pskb->dev = adapter->pnetdev; 817 - 818 - tmpaddr = (SIZE_PTR)recvbuf->pskb->data; 819 - alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1); 820 - skb_reserve(recvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment)); 821 - } 822 - 823 814 if (!recvbuf->pskb) 824 815 return NULL; 816 + 817 + recvbuf->pskb->dev = adapter->pnetdev; 818 + 819 + tmpaddr = (SIZE_PTR)recvbuf->pskb->data; 820 + alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1); 821 + skb_reserve(recvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment)); 825 822 } 826 823 827 824 /* 3 3. read data from rxfifo */