[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220408085158.GS3293@kadam>
Date: Fri, 8 Apr 2022 11:51:58 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Yihao Han <hanyihao@...o.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Fabio Aiuto <fabioaiuto83@...il.com>,
Hans de Goede <hdegoede@...hat.com>,
"Fabio M. De Francesco" <fmdefrancesco@...il.com>,
Xiangyang Zhang <xyz.sun.ok@...il.com>,
Lee Jones <lee.jones@...aro.org>,
Bryan Brattlof <hello@...anbrattlof.com>,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
kernel@...o.com
Subject: Re: [PATCH] staging: rtl8723bs: simplify if-if to if-else
On Fri, Apr 08, 2022 at 12:42:40AM -0700, Yihao Han wrote:
> Replace `if (!recvbuf->pskb)` with `else` for simplification and add curly
> brackets according to the kernel coding style:
>
> "Do not unnecessarily use braces where a single statement will do."
>
> ...
>
> "This does not apply if only one branch of a conditional statement is
> a single statement; in the latter case use braces in both branches"
>
> Please refer to:
> https://www.kernel.org/doc/html/v5.17-rc8/process/coding-style.html
>
> Signed-off-by: Yihao Han <hanyihao@...o.com>
> ---
> drivers/staging/rtl8723bs/hal/sdio_ops.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
> index a545832a468e..739fea437f69 100644
> --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
> +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
> @@ -818,10 +818,9 @@ static struct recv_buf *sd_recv_rxfifo(struct adapter *adapter, u32 size)
> tmpaddr = (SIZE_PTR)recvbuf->pskb->data;
> alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1);
> skb_reserve(recvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment));
> - }
> -
> - if (!recvbuf->pskb)
> + } else {
> return NULL;
> + }
Please do it a different way:
recvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
if (!recvbuf->pskb)
return NULL;
Then pull the pull the other side in one tab.
regards,
dan carpenter
Powered by blists - more mailing lists