public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	Sergey Rozhnov <rozhnov.sergey.89@gmail.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Florian Schilhabel <florian.c.schilhabel@googlemail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-staging@lists.linux.dev,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: rtl8712: Remove redundant braces in if statements
Date: Thu, 20 Jul 2023 23:34:15 -0700	[thread overview]
Message-ID: <a88dd19ab97721a2db228bb070c8eb5d80751e7f.camel@perches.com> (raw)
In-Reply-To: <5db3658a-2594-45db-b76a-4aa40950ebd5@kadam.mountain>

On Fri, 2023-07-21 at 09:01 +0300, Dan Carpenter wrote:
> On Fri, Jul 21, 2023 at 06:05:57AM +0400, Sergey Rozhnov wrote:
> > Extract masked value to improve readability, apply fix suggested by checkpatch.
> > ---
> 
> I like the new format, but you need to run checkpatch on your patches.
> 

True, but this does only 1 of 2 very similar functions.
Ideally both would be done at the same time.

My preference would be to remove the int i and just
dereference rate similar to:

uint r8712_is_cckrates_included(u8 *rate)
{
	while (*rate) {
		u8 r = *rate & 0x7f;

		if (r == 2 || r == 4 || r == 11 || r == 22)
			return true;
		rate++;
	}

	return false;
}

uint r8712_is_cckratesonly_included(u8 *rate)
{
	while (*rate) {
		u8 r = *rate & 0x7f;

		if (r != 2 && r != 4 && r != 11  && r != 22)
			return false;
		rate++;
	}

	return true;
}

though the existing cckratesonly_included function
seemingly returns an incorrect true if the rate array
is empty.



      reply	other threads:[~2023-07-21  7:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21  2:05 [PATCH] staging: rtl8712: Remove redundant braces in if statements Sergey Rozhnov
2023-07-21  4:11 ` Greg Kroah-Hartman
2023-07-21  4:57 ` Larry Finger
2023-07-21  6:01 ` Dan Carpenter
2023-07-21  6:34   ` Joe Perches [this message]

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=a88dd19ab97721a2db228bb070c8eb5d80751e7f.camel@perches.com \
    --to=joe@perches.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=dan.carpenter@linaro.org \
    --cc=florian.c.schilhabel@googlemail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=rozhnov.sergey.89@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox