All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Yihao Han <hanyihao@vivo.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Fabio Aiuto <fabioaiuto83@gmail.com>,
	Hans de Goede <hdegoede@redhat.com>,
	"Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
	Xiangyang Zhang <xyz.sun.ok@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Bryan Brattlof <hello@bryanbrattlof.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	kernel@vivo.com
Subject: Re: [PATCH] staging: rtl8723bs: simplify if-if to if-else
Date: Fri, 8 Apr 2022 11:51:58 +0300	[thread overview]
Message-ID: <20220408085158.GS3293@kadam> (raw)
In-Reply-To: <20220408074245.13694-1-hanyihao@vivo.com>

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@vivo.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



  reply	other threads:[~2022-04-08  8:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08  7:42 [PATCH] staging: rtl8723bs: simplify if-if to if-else Yihao Han
2022-04-08  8:51 ` Dan Carpenter [this message]
2022-04-08 13:59   ` [PATCH v2] staging: rtl8723bs: remove unnecessary `if` Yihao Han
2022-04-08 14:12     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220408085158.GS3293@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=fabioaiuto83@gmail.com \
    --cc=fmdefrancesco@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hanyihao@vivo.com \
    --cc=hdegoede@redhat.com \
    --cc=hello@bryanbrattlof.com \
    --cc=kernel@vivo.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=xyz.sun.ok@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.