Re: likely/unlikely usage validation

2024-05-29 Thread Rasmus Villemoes
On 28/05/2024 14.51, Rasmus Villemoes wrote: > Actually, perhaps coccinelle would be a simpler place to implement a > check like this. So I got curious and wrote a .cocci looking for this kind of pattern, and apart from the stuff found via grep there were only two more instances. The fi

Re: likely/unlikely usage validation

2024-05-28 Thread Rasmus Villemoes
On 28/05/2024 14.21, Mateusz Guzik wrote: > On Tue, May 28, 2024 at 2:03 PM Rasmus Villemoes > wrote: >> >> scripts/checkpatch.pl:# likely/unlikely comparisons similar to >> "(likely(foo) > 0)" >> >> So checkpatch should already have such a ch

Re: likely/unlikely usage validation

2024-05-28 Thread Rasmus Villemoes
On 28/05/2024 12.37, Mateusz Guzik wrote: > I misplaced a closing ) in a patch using unlikely() and broke the > comparison, see [1] for context. > > The fix was: > - if (unlikely(abs(count + amount)) >= batch) { > + if (unlikely(abs(count + amount) >= batch)) { > > Nei