All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: "Alex A. Mihaylov" <minimumlaw@rambler.ru>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sebastian Reichel <sre@kernel.org>,
	Evgeniy Polyakov <zbr@ioremap.net>,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH 1/3] regmap: Add OneWire (W1) bus support
Date: Tue, 30 May 2017 12:50:40 +0100	[thread overview]
Message-ID: <20170530115040.awy7y5rv7ouub6k6@sirena.org.uk> (raw)
In-Reply-To: <f4efbd7b-6b65-1344-dc36-8695d1d451e8@rambler.ru>

[-- Attachment #1: Type: text/plain, Size: 1481 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2017-05-30 11:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-28  7:11 [PATCH 0/3] Battery monitor MAX1721x with w1-regmap and w1-slave Alex A. Mihaylov
2017-05-28  7:11 ` [PATCH 1/3] regmap: Add OneWire (W1) bus support Alex A. Mihaylov
2017-05-29 13:13   ` Mark Brown
2017-05-29 16:37     ` Alex A. Mihaylov
2017-05-30 11:50       ` Mark Brown [this message]
2017-05-29 15:07   ` Geert Uytterhoeven
2017-05-28  7:11 ` [PATCH 2/3] w1: Add Maxim Semiconductor MAX1721x W1 slave drivers Alex A. Mihaylov
2017-05-28  7:11 ` [PATCH 3/3] power: supply: Add support MAX1721x battery monitor Alex A. Mihaylov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170530115040.awy7y5rv7ouub6k6@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=minimumlaw@rambler.ru \
    --cc=sre@kernel.org \
    --cc=zbr@ioremap.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.