Re: 2.6.18-rc1-mm2

David Miller
2006-07-16T01:19:06Z

From: Dave Jones <davej@redhat.com>
Date: Sat, 15 Jul 2006 02:04:00 -0400

> Ick, nasty. Seems there's quite a few instances of that construct around.

The cases you grepped out here all seem to be OK to my eyes.
They fall into two categories of legitimate uses:

1) The return value really is a boolean, 0 or 1, so using
likely/unlikely around it is fine.

In fact, for a inline function returning a boolean, this
is a way to get the likely'ness to propagate into a test
done by the caller.

2) The likely() is part of some real check such as:

return (likely(test_val) ? x : y);

which is also fine.

Like I said, the bad case is only when the unlikely() or likely()
surrounds an expression that is not expected to evaluate to
a boolean.