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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.







[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux