mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Hoorad Farrokh <hourrad.f@gmail.com>
Cc: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: rtl8723bs: remove unnecessary braces in while loop
Date: Mon, 22 Jan 2024 10:37:58 +0300	[thread overview]
Message-ID: <39fbf9df-d6da-4275-be3b-191108f94ec2@moroto.mountain> (raw)
In-Reply-To: <4ii7ptqhz7ion46dczabnevuj7tjfv4iofvzedms6tvfgsfu2e@6rvcsdyodny2>

On Mon, Jan 22, 2024 at 09:01:27AM +1300, Hoorad Farrokh wrote:
> Fixed a linux coding style.
> 
> Reported by checkpath:
> 
> WARNING: braces {} are not necessary for single statement blocks
> 
> Signed-off-by: Hoorad Farrokh <hourrad.f@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
> index 1593980d2c6a..0145c4da5ac0 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
> @@ -127,9 +127,8 @@ void kfree_all_stainfo(struct sta_priv *pstapriv)
>  	phead = get_list_head(&pstapriv->free_sta_queue);
>  	plist = get_next(phead);
>  
> -	while (phead != plist) {
> +	while (phead != plist)
>  		plist = get_next(plist);
> -	}

This function doesn't do anything...  The name says "free_all" but it
doesn't free anything.  I would prefer to fix this warning by adding
a comment:

diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
index 1593980d2c6a..4f856d126517 100644
--- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
@@ -129,6 +129,7 @@ void kfree_all_stainfo(struct sta_priv *pstapriv)
 
        while (phead != plist) {
                plist = get_next(plist);
+               /* FIXME: free something? */
        }
 
        spin_unlock_bh(&pstapriv->sta_hash_lock);

We can also try adding that to the KTODO list.

KTODO: why does kfree_all_stainfo() not free anything.

Perhaps there is code in the other rtl drivers which shows how this
should be done?

regards,
dan carpenter


  reply	other threads:[~2024-01-22  7:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-21 20:01 Hoorad Farrokh
2024-01-22  7:37 ` Dan Carpenter [this message]
2024-01-22 23:28   ` Hoorad Farrokh
2024-01-23  6:10     ` 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=39fbf9df-d6da-4275-be3b-191108f94ec2@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hourrad.f@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®