From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
To: Esben Haabendal <esben@geanix.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Nikita Travkin" <nikita@trvn.ru>,
"Maslov Dmitry" <maslovdmitry@seeed.cc>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] iio: light: ltr501: Power down chip if request irq fails
Date: Sun, 19 Jul 2026 02:51:58 +0100 [thread overview]
Message-ID: <20260719025158.1e4246c6@jic23-huawei> (raw)
In-Reply-To: <20260715-liteon-ltr329-v2-4-d18af55edab5@geanix.com>
On Wed, 15 Jul 2026 14:27:26 +0200
Esben Haabendal <esben@geanix.com> wrote:
> In case request irq failed, we were leaving the chip powered instead of
> powering it down again.
>
> Signed-off-by: Esben Haabendal <esben@geanix.com>
> ---
> drivers/iio/light/ltr501.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
> index 379e57ac5f5b..9d4de798e5ab 100644
> --- a/drivers/iio/light/ltr501.c
> +++ b/drivers/iio/light/ltr501.c
> @@ -1571,7 +1571,7 @@ static int ltr501_probe(struct i2c_client *client)
> if (ret) {
> dev_err(&client->dev, "request irq (%d) failed\n",
> client->irq);
> - return ret;
> + goto powerdown_on_error;
A goto after a devm call rings ordering alarm bells. The two calls will
be reverse of expected order (error handling generally reverse order of
setup).
Instead of doing this, register an extra callback with devm_add_action_or_reset()
for the power down. That will do for the fix, then if you have time
convert remaining two calls to devm as well in a follow up patch.
Jonathan
> }
> } else {
> indio_dev->info = data->chip_info->info_no_irq;
>
next prev parent reply other threads:[~2026-07-19 1:52 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 12:27 [PATCH v2 0/4] iio: light: ltr501: Add ltr329 support Esben Haabendal
2026-07-15 12:27 ` [PATCH v2 1/4] dt-bindings: iio: light: ltr501: Add missing ltr303 compatible Esben Haabendal
2026-07-15 12:37 ` sashiko-bot
2026-07-16 8:05 ` Krzysztof Kozlowski
2026-07-16 8:06 ` Krzysztof Kozlowski
2026-07-15 12:27 ` [PATCH v2 2/4] dt-bindings: iio: light: ltr501: Add ltr329 compatible Esben Haabendal
2026-07-16 8:07 ` Krzysztof Kozlowski
2026-07-16 16:14 ` Esben Haabendal
2026-07-19 1:38 ` Jonathan Cameron
2026-07-15 12:27 ` [PATCH v2 3/4] iio: light: ltr501: Add ltr329 driver support Esben Haabendal
2026-07-15 12:48 ` sashiko-bot
2026-07-15 12:53 ` Joshua Crofts
2026-07-15 13:55 ` Esben Haabendal
2026-07-15 13:58 ` Joshua Crofts
2026-07-15 13:16 ` Nuno Sá
2026-07-15 13:43 ` Esben Haabendal
2026-07-15 14:25 ` Nuno Sá
2026-07-19 1:47 ` Jonathan Cameron
2026-07-15 12:27 ` [PATCH v2 4/4] iio: light: ltr501: Power down chip if request irq fails Esben Haabendal
2026-07-15 12:59 ` Joshua Crofts
2026-07-15 13:32 ` Esben Haabendal
2026-07-15 13:01 ` Nuno Sá
2026-07-15 13:31 ` Esben Haabendal
2026-07-15 13:53 ` Esben Haabendal
2026-07-19 1:51 ` Jonathan Cameron [this message]
2026-07-15 12:55 ` [PATCH v2 0/4] iio: light: ltr501: Add ltr329 support Joshua Crofts
2026-07-15 13:17 ` Nuno Sá
2026-07-15 13:34 ` Esben Haabendal
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=20260719025158.1e4246c6@jic23-huawei \
--to=jonathan.cameron@oss.qualcomm.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=esben@geanix.com \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maslovdmitry@seeed.cc \
--cc=nikita@trvn.ru \
--cc=nuno.sa@analog.com \
--cc=robh@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