linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Chris Packham <Chris.Packham@alliedtelesis.co.nz>
Cc: "linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v4 2/2] spi: Add generic SPI multiplexer
Date: Tue, 4 Feb 2020 13:07:48 +0200	[thread overview]
Message-ID: <CAHp75VdRYDrTeBy9+TbbE8y3jt_Fntr6fnXon3CuqCZFYQ7Maw@mail.gmail.com> (raw)
In-Reply-To: <86509a5e6656c4f560ee6f6514ab00a232994957.camel@alliedtelesis.co.nz>

On Mon, Feb 3, 2020 at 11:12 PM Chris Packham
<Chris.Packham@alliedtelesis.co.nz> wrote:
> On Mon, 2020-02-03 at 11:50 +0200, Andy Shevchenko wrote:

...

> > > +       priv->mux = devm_mux_control_get(&spi->dev, NULL);
> > > +       ret = PTR_ERR_OR_ZERO(priv->mux);
> >
> > This is a bit complicated.
> >
> > > +       if (ret) {
> >
> > Why not simple do
> >
> >   if (IS_ERR(priv->mux)) {
> >     ret = PTR_ERR(...);
> >     ...
> >   }
> >
> > ?
>
> I've had other maintainers/reviewers suggest the opposite for patches
> I've submitted to other subsystems which is why I went with
> PTR_ERR_OR_ZERO. It also works well with the goto err_put_ctlr; which
> needs ret to be set. It's not exactly a common pattern in the spi code
> so I'd be happy to go the other way if that's the desired convention
> for spi.

Either way is the same amount of lines. The slight difference, that we
don't check for 0. Can you check if generated code is different in
these cases?

-- 
With Best Regards,
Andy Shevchenko

      reply	other threads:[~2020-02-04 11:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31  2:34 [PATCH v4 0/2] SPI bus multiplexing Chris Packham
2020-01-31  2:34 ` [PATCH v4 1/2] dt-bindings: spi: Document binding for generic SPI multiplexer Chris Packham
2020-01-31 14:12   ` Rob Herring
2020-01-31  2:34 ` [PATCH v4 2/2] spi: Add " Chris Packham
2020-02-03  9:50   ` Andy Shevchenko
2020-02-03 21:11     ` Chris Packham
2020-02-04 11:07       ` Andy Shevchenko [this message]

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=CAHp75VdRYDrTeBy9+TbbE8y3jt_Fntr6fnXon3CuqCZFYQ7Maw@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=Chris.Packham@alliedtelesis.co.nz \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).