linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "Nuno Sá" <noname.nuno@gmail.com>
Cc: nuno.sa@analog.com,
	Michael Hennerich <michael.hennerich@analog.com>,
	linux-input@vger.kernel.org
Subject: Re: [PATCH 1/4] Input: adp5588-keys: bail on returned error
Date: Wed, 2 Oct 2024 04:28:16 -0700	[thread overview]
Message-ID: <Zv0uUH6dV_bFK6M-@google.com> (raw)
In-Reply-To: <58d1af4cddbbf5f96cc5f3d08eae4250b636b257.camel@gmail.com>

On Wed, Oct 02, 2024 at 01:23:18PM +0200, Nuno Sá wrote:
> On Wed, 2024-10-02 at 04:09 -0700, Dmitry Torokhov wrote:
> > Hi Nuno,
> > 
> > On Wed, Oct 02, 2024 at 12:51:50PM +0200, Nuno Sa via B4 Relay wrote:
> > > @@ -455,8 +457,16 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad)
> > >  	for (i = 0; i <= ADP5588_BANK(ADP5588_MAXGPIO); i++) {
> > >  		kpad->dat_out[i] = adp5588_read(kpad->client,
> > >  						GPIO_DAT_OUT1 + i);
> > > +		if (kpad->dat_out[i] < 0)
> > > +			return kpad->dat_out[i];
> > > +
> > >  		kpad->dir[i] = adp5588_read(kpad->client, GPIO_DIR1 + i);
> > > +		if (kpad->dir[i] < 0)
> > > +			return kpad->dir[i];
> > > +
> > >  		kpad->pull_dis[i] = adp5588_read(kpad->client, GPIO_PULL1 + i);
> > > +		if (kpad->pull_dis[i] < 0)
> > > +			return kpad->pull_dis[i];
> > 
> > 
> > Unfortunately all these are u8 so they will never be negative. You need
> > to do the adp5588_read() refactor first and then (or maybe together) add
> > error checking.
> > 
> 
> Ahh crap... Completely missed that. Yeah, will see what looks better... Thanks for
> catching this.
> 
> BTW, this is also wrong in the adp5589 series.

I didn't get that far there ;)

Thanks.

-- 
Dmitry

  reply	other threads:[~2024-10-02 11:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 10:51 [PATCH 0/4] Input: adp5588-keys: refactor adp5588_read() Nuno Sa via B4 Relay
2024-10-02 10:51 ` [PATCH 1/4] Input: adp5588-keys: bail on returned error Nuno Sa via B4 Relay
2024-10-02 11:09   ` Dmitry Torokhov
2024-10-02 11:23     ` Nuno Sá
2024-10-02 11:28       ` Dmitry Torokhov [this message]
2024-10-02 10:51 ` [PATCH 2/4] Input: adp5588-keys: refactor adp5589_read() Nuno Sa via B4 Relay
2024-10-02 10:51 ` [PATCH 3/4] Input: adp5588-keys: error out if no IRQ is given Nuno Sa via B4 Relay
2024-10-02 10:51 ` [PATCH 4/4] Input: adp5588-keys: make use of dev_err_probe() Nuno Sa via B4 Relay

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=Zv0uUH6dV_bFK6M-@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    --cc=noname.nuno@gmail.com \
    --cc=nuno.sa@analog.com \
    /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).