All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
	linux-iio@vger.kernel.org, "Hartmut Knaack" <knaack.h@gmx.de>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Peter Meerwald-Stadler" <pmeerw@pmeerw.net>,
	linux-input@vger.kernel.org,
	"Stephan Gerhold" <stephan@gerhold.net>,
	"Donggeun Kim" <dg77.kim@samsung.com>,
	"Minkyu Kang" <mk7.kang@samsung.com>,
	"Paweł Chmiel" <pawel.mikolaj.chmiel@gmail.com>,
	"Jonathan Bakker" <xc-racer2@live.ca>,
	"Oskar Andero" <oskar.andero@gmail.com>
Subject: Re: [PATCH 2/2 v1] iio: light: Add a driver for Sharp GP2AP002x00F
Date: Thu, 2 Jan 2020 14:15:33 -0800	[thread overview]
Message-ID: <20200102221533.GC8314@dtor-ws> (raw)
In-Reply-To: <20191230173919.373f4e8a@archlinux>

Hi Jonathan,

On Mon, Dec 30, 2019 at 05:39:19PM +0000, Jonathan Cameron wrote:
> On Sat, 28 Dec 2019 21:11:09 +0100
> Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> > +	/* Enable chip and IRQ, disable analog sleep */
> > +	ret = regmap_write(gp2ap002->map, GP2AP002_OPMOD,
> > +			   OPMOD_SSD_OPERATING | OPMOD_VCON_IRQ);
> > +	if (ret < 0) {
> > +		dev_err(gp2ap002->dev, "error setting up operation mode\n");
> > +		return ret;
> > +	}
> > +
> > +	/* Interrupt on VOUT enabled */
> > +	ret = regmap_write(gp2ap002->map, GP2AP002_CON, CON_OCON_ENABLE);
> > +	if (ret < 0) {
> > +		dev_err(gp2ap002->dev, "error setting up VOUT control\n");
> > +		return ret;
> 
> drop this return ret out of the brackets as it's either 0 or negative anyway.

Not my subsystem, but $0.02 anyways: I like calling the temp as "error"
and explicitly return 0 in the success path even if it could be
collapsed, as you can easily add more initialization without needing
to go and alter previous blocks.

Thanks.

-- 
Dmitry

  reply	other threads:[~2020-01-02 22:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-28 20:11 [PATCH 1/2 v1] iio: light: Add DT bindings for GP2AP002 Linus Walleij
2019-12-28 20:11 ` [PATCH 2/2 v1] iio: light: Add a driver for Sharp GP2AP002x00F Linus Walleij
2019-12-30 17:39   ` Jonathan Cameron
2020-01-02 22:15     ` Dmitry Torokhov [this message]
2020-01-05 10:36       ` Jonathan Cameron
2020-01-06  9:08     ` Linus Walleij
2020-01-07 11:59       ` Jonathan Cameron
2020-01-08 16:46 ` [PATCH 1/2 v1] iio: light: Add DT bindings for GP2AP002 Rob Herring

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=20200102221533.GC8314@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=dg77.kim@samsung.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=mk7.kang@samsung.com \
    --cc=oskar.andero@gmail.com \
    --cc=pawel.mikolaj.chmiel@gmail.com \
    --cc=pmeerw@pmeerw.net \
    --cc=stephan@gerhold.net \
    --cc=xc-racer2@live.ca \
    /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.