Messages in this thread | | | From | Paul Zimmerman <> | Subject | RE: [PATCH v3 2/2] usb: dwc2: gadget: modify return statement | Date | Fri, 17 Oct 2014 18:10:54 +0000 |
| |
> From: Sudip Mukherjee [mailto:sudipm.mukherjee@gmail.com] > Sent: Friday, October 17, 2014 3:03 AM > > On Fri, Oct 17, 2014 at 09:02:00AM +0000, David Laight wrote: > > From: Of Sudip Mukherjee > > > modified the function to have a single return statement at the end > > > instead of multiple return statement in the middle of the function > > > to improve the readability of the code. > > > > Many of us would disagree with you there. > > Early returns actually make the code easier to read, certainly > > better than a goto 'end of function'. > > > actually , frankly speaking, this first return statement was also easier for me to understand. But in > my v1 patch , Paul mentioned : > >For a long function like this, I'd rather keep a single return point at > >the end. > so I thought he meant all the return statements in the function.
What I didn't like about your first patch was that there were two places where the spinlock was released. I think that is error-prone, as can be seen by the original bug. But I am OK with leaving the first return statement as-is, since the spinlock is not held there.
So I think we should apply patch 1, and drop patch 2.
-- Paul
| |