From: Joshua Crofts <joshua.crofts1@gmail.com>
To: Linmao Li <lilinmao@kylinos.cn>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Andreas Brauchli" <a.brauchli@elementarea.net>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: chemical: sgp30: Handle IAQ thread creation failure
Date: Wed, 22 Jul 2026 14:52:18 +0200 [thread overview]
Message-ID: <20260722145218.000030cc@gmail.com> (raw)
In-Reply-To: <20260722074837.2258269-1-lilinmao@kylinos.cn>
On Wed, 22 Jul 2026 15:48:37 +0800
Linmao Li <lilinmao@kylinos.cn> wrote:
> kthread_run() can fail and return an error pointer, but sgp_probe() stores
> it and returns success, so the device is registered without its IAQ thread
> and sgp_remove() later passes the error pointer to kthread_stop(). Return
> the error from probe instead.
>
> Fixes: ce514124161a ("iio: chemical: sgp30: Support Sensirion SGP30/SGPC3 sensors")
> Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
> ---
> drivers/iio/chemical/sgp30.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iio/chemical/sgp30.c b/drivers/iio/chemical/sgp30.c
> index f10bbebc29e4..379c1c4af8d8 100644
> --- a/drivers/iio/chemical/sgp30.c
> +++ b/drivers/iio/chemical/sgp30.c
> @@ -548,6 +548,9 @@ static int sgp_probe(struct i2c_client *client)
>
> data->iaq_thread = kthread_run(sgp_iaq_threadfn, data,
> "%s-iaq", data->client->name);
> + if (IS_ERR(data->iaq_thread))
> + return dev_err_probe(dev, PTR_ERR(data->iaq_thread),
> + "failed to start IAQ thread\n");
>
> return 0;
> }
Good catch! This should also be marked for stable, perhaps Jonathan
can do that while applying.
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
--
Kind regards,
Joshua Crofts
next prev parent reply other threads:[~2026-07-22 12:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 7:48 [PATCH] iio: chemical: sgp30: Handle IAQ thread creation failure Linmao Li
2026-07-22 12:52 ` Joshua Crofts [this message]
2026-07-24 23:21 ` Jonathan Cameron
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=20260722145218.000030cc@gmail.com \
--to=joshua.crofts1@gmail.com \
--cc=a.brauchli@elementarea.net \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=lilinmao@kylinos.cn \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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