Re: [PATCH] staging: rtl8712: Remove redundant braces in if statements

From: Joe Perches
Date: Fri Jul 21 2023 - 02:34:25 EST


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.