Skip to content

Commit

Permalink
iio: temp: maxim-thermocouple: Fix potential lack of DMA safe buffer.
Browse files Browse the repository at this point in the history
The trick of using __aligned(IIO_DMA_MINALIGN) ensures that there is
no overlap between buffers used for DMA and those used for driver
state storage that are before the marking. It doesn't ensure
anything above state variables found after the marking. Hence
move this particular bit of state earlier in the structure.

Fixes: 10897f3 ("iio: temp: maxim_thermocouple: Fix alignment for DMA safety")
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250413103443.2420727-14-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  • Loading branch information
Jonathan Cameron authored and Jonathan Cameron committed Apr 18, 2025
1 parent 6ffa698 commit f79aeb6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/temperature/maxim_thermocouple.c
Original file line number Diff line number Diff line change
@@ -121,9 +121,9 @@ static const struct maxim_thermocouple_chip maxim_thermocouple_chips[] = {
struct maxim_thermocouple_data {
struct spi_device *spi;
const struct maxim_thermocouple_chip *chip;
char tc_type;

u8 buffer[16] __aligned(IIO_DMA_MINALIGN);
char tc_type;
};

static int maxim_thermocouple_read(struct maxim_thermocouple_data *data,

0 comments on commit f79aeb6

Please sign in to comment.