Skip to content

Commit 5cb9fdb

Browse files
leaveyoustunjic23
authored andcommitted
iio: temperature: ltc2983: Fix reinit_completion() called after conversion start
reinit_completion() was called after regmap_write() initiated the hardware conversion, creating a race window where the interrupt could fire and call complete() before reinit_completion() reset the completion. Move reinit_completion() before the regmap_write() to close the race. ltc2983_eeprom_cmd() already does it in the correct order. Fixes: f110f31 ("iio: temperature: Add support for LTC2983") Signed-off-by: Liviu Stan <liviu.stan@analog.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent 434c150 commit 5cb9fdb

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/iio/temperature/ltc2983.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,12 +1177,11 @@ static int ltc2983_chan_read(struct ltc2983_data *st,
11771177
start_conversion |= LTC2983_STATUS_CHAN_SEL(sensor->chan);
11781178
dev_dbg(&st->spi->dev, "Start conversion on chan:%d, status:%02X\n",
11791179
sensor->chan, start_conversion);
1180+
reinit_completion(&st->completion);
11801181
/* start conversion */
11811182
ret = regmap_write(st->regmap, LTC2983_STATUS_REG, start_conversion);
11821183
if (ret)
11831184
return ret;
1184-
1185-
reinit_completion(&st->completion);
11861185
/*
11871186
* wait for conversion to complete.
11881187
* 300 ms should be more than enough to complete the conversion.

0 commit comments

Comments
 (0)