[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170530115040.awy7y5rv7ouub6k6@sirena.org.uk>
Date: Tue, 30 May 2017 12:50:40 +0100
From: Mark Brown <broonie@...nel.org>
To: "Alex A. Mihaylov" <minimumlaw@...bler.ru>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sebastian Reichel <sre@...nel.org>,
Evgeniy Polyakov <zbr@...emap.net>,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Subject: Re: [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.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists