diff options
| author | Linmao Li <lilinmao@kylinos.cn> | 2026-07-22 15:48:37 +0800 |
|---|---|---|
| committer | Jonathan Cameron <jonathan.cameron@oss.qualcomm.com> | 2026-07-26 19:19:36 +0100 |
| commit | 1135d6875d2dbda3f6ec718f3421a6ce4378bd63 (patch) | |
| tree | 654c482cb602f374cf9843d139361a6c732050f3 | |
| parent | 8dc6d241fc1f50231d56d6600ef23a5ee4a53967 (diff) | |
| download | linux-1135d6875d2dbda3f6ec718f3421a6ce4378bd63.tar.gz linux-1135d6875d2dbda3f6ec718f3421a6ce4378bd63.zip | |
iio: chemical: sgp30: Handle IAQ thread creation failure
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>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
| -rw-r--r-- | drivers/iio/chemical/sgp30.c | 3 |
1 files changed, 3 insertions, 0 deletions
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; } |
