Messages in this thread | | | Date | Thu, 20 Jul 2023 23:57:56 -0500 | Subject | Re: [PATCH] staging: rtl8712: Remove redundant braces in if statements | From | Larry Finger <> |
| |
On 7/20/23 21:05, Sergey Rozhnov wrote: > Extract masked value to improve readability, apply fix suggested by checkpatch. > --- > drivers/staging/rtl8712/ieee80211.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/rtl8712/ieee80211.c b/drivers/staging/rtl8712/ieee80211.c > index 7d8f1a29d18a..fe53453ab9a7 100644 > --- a/drivers/staging/rtl8712/ieee80211.c > +++ b/drivers/staging/rtl8712/ieee80211.c > @@ -63,8 +63,9 @@ uint r8712_is_cckrates_included(u8 *rate) > u32 i = 0; > > while (rate[i] != 0) { > - if ((((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) || > - (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22)) > + u8 val = rate[i] & 0x7f; > + > + if (val == 2 || val == 4 || val == 11 || val == 22) > return true; > i++; > }
The value of such a patch is marginal. The compiler will optimize it and only calculate the value of rate[i] & 0x7f once, and keep it in a register, which is likely what happens with your change as val will never be used again. Checkpatch is only suggestive and can be ignored.
You have no signed-off-by tag. As such, this patch could never be applied as it has no one vouching that they are the author. Please read and follow the instructions for submitting patches.
Larry
| |