All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: nuno.sa@analog.com
Cc: 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:09:01 -0700	[thread overview]
Message-ID: <Zv0pzelCZJpI0dxa@google.com> (raw)
In-Reply-To: <20241002-fix-adp5588-read-refactor-v1-1-28800f1b9773@analog.com>

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.

Thanks.

-- 
Dmitry

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

Thread overview: 13+ 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
2024-10-02 10:51 ` Nuno Sa via B4 Relay
2024-10-02 10:51 ` [PATCH 1/4] Input: adp5588-keys: bail on returned error Nuno Sa
2024-10-02 10:51   ` Nuno Sa via B4 Relay
2024-10-02 11:09   ` Dmitry Torokhov [this message]
2024-10-02 11:23     ` Nuno Sá
2024-10-02 11:28       ` Dmitry Torokhov
2024-10-02 10:51 ` [PATCH 2/4] Input: adp5588-keys: refactor adp5589_read() Nuno Sa
2024-10-02 10:51   ` 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
2024-10-02 10:51   ` Nuno Sa via B4 Relay
2024-10-02 10:51 ` [PATCH 4/4] Input: adp5588-keys: make use of dev_err_probe() Nuno Sa
2024-10-02 10:51   ` 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=Zv0pzelCZJpI0dxa@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=michael.hennerich@analog.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 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.