Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1290631

Re: [PATCH v2 01/10] usb: host: ehci-sched: refactor scan_isoc function

From Alan Stern <stern@rowland.harvard.edu>
Newsgroups linux.kernel
Subject Re: [PATCH v2 01/10] usb: host: ehci-sched: refactor scan_isoc function
Date 2015-12-13 16:30 +0100
Message-ID <qFgL0-1Da-3@gated-at.bofh.it> (permalink)
References <qF68W-3nC-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, 13 Dec 2015, Geyslan G. Bem wrote:

> This patch removes an infinite 'for' loop and makes use of the already
> existing 'restart' tag instead, reducing one leading tab.
> 
> It also puts the easier evaluation (live variable) to be the first in
> two conditionals.
> 
>   if (live && frame == now_frame) { ...
> 
>   if (live && ((frame == now_frame) || ...

You should never do this.  The first test in a conditional should be 
the one that is most likely to cause the expression to fail.  In this 
case, live is almost always true whereas frame == now_frame is true 
only some percentage of the time.  Therefore the frame == now_frame 
test should come first.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 01/10] usb: host: ehci-sched: refactor scan_isoc function "Geyslan G. Bem" <geyslan@gmail.com> - 2015-12-13 05:10 +0100
  Re: [PATCH v2 01/10] usb: host: ehci-sched: refactor scan_isoc  function Alan Stern <stern@rowland.harvard.edu> - 2015-12-13 16:30 +0100
    Re: [PATCH v2 01/10] usb: host: ehci-sched: refactor scan_isoc function "Geyslan G. Bem" <geyslan@gmail.com> - 2015-12-13 17:40 +0100

csiph-web