Re: [PATCH] staging: wlags49_h2: Replace kmalloc+memset by kzalloc and add error handling.

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

 



Hi,

On Fri, Mar 23, 2012 at 12:41 PM, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> And I bet they are used wrong there.  Again, unless you are in some very
> performance critical section of code, don't use unlikely().
>
> The big thing is that it just is not needed at all.  Don't try to be
> smarter than the compiler if you don't need it, _AND_ you haven't
> actually measured it.

Nice answer. I did a quick grep and I found this scary result:

~/devel/v4l-dvb $ grep -r -n "unlikely(" drivers/ | wc -l
5018

I wonder perhaps we could add a check for unlikely in checkpatch script?
Something like: "are you sure about this"?

Also, perhaps this quote from [1] should be somewhere in Documentation:

"How should I use it ?
You should use it only in cases when the likeliest branch is very very
very likely, or when the unlikeliest branch is very very very
unlikely."

[1] http://kernelnewbies.org/FAQ/LikelyUnlikely
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux