lkml.org 
[lkml]   [2017]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3] regmap: Add OneWire (W1) bus support
On Mon, May 29, 2017 at 07:37:58PM +0300, Alex A. Mihaylov wrote:
> 29.05.17 16:13, Mark Brown пишет:

> > I asked you to move the error handling into the else case in these :(

> Why do you want to see exactly the construction of if/else?

I want to see some error handling in the lock so it doesn't look like
it's missing, especially since this is the unusual pattern of "mark it
as OK in an if statement then carry on running". The code pattern is
too unusual and there's too much code and blank space between the ret =
0 meaning it takes too much effort to slow down and check that there's
not a bug.

> I already wrote that for me this will worsen the quality and understanding
> of the code. And another point - in fact it is not an error handler. This is
> a completely normal and permissible situation. There is no "disconnect"

It's an error. It may be an expected and recoverable error but as far
as this write is concerned it's an error.

> I can see this pattern in other kernel place, like:
> drivers/usb/musb/da8xx.c line 374

This one for example looks like normal code - it's jumping to error in
the error handling cases, the success case is a normal direct return
with the error cases in the if checks and there's multiple conditions
that could trigger an error. You need to get out of the locked region
so you have limited options but only have one conditional, moving the
assignment inside the else seems like the clearest.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2017-05-30 13:51    [W:0.353 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site