lkml.org 
[lkml]   [2014]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v3 2/2] usb: dwc2: gadget: modify return statement
Date
> 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



\
 
 \ /
  Last update: 2014-10-17 20:41    [W:3.329 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site