Re: [PATCH 1/3] regmap: Add OneWire (W1) bus support
From: Mark Brown
Date: Tue May 30 2017 - 07:51:03 EST
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.
Attachment:
signature.asc
Description: PGP signature