[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210712060745.445343473@linuxfoundation.org>
Date: Mon, 12 Jul 2021 08:11:37 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Song Qiang <songqiang1304521@...il.com>,
Nuno Sá <nuno.sa@...log.com>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH 5.4 313/348] iio: magn: rm3100: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
[ Upstream commit b8f939fd20690623cb24845a563e7bc1e4a21482 ]
Add __aligned(8) to ensure the buffer passed to
iio_push_to_buffers_with_timestamp() is suitable for the naturally
aligned timestamp that will be inserted.
Here an explicit structure is not used, because this buffer is used in
a non-trivial way for data repacking.
Fixes: 121354b2eceb ("iio: magnetometer: Add driver support for PNI RM3100")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: Song Qiang <songqiang1304521@...il.com>
Reviewed-by: Nuno Sá <nuno.sa@...log.com>
Link: https://lore.kernel.org/r/20210613152301.571002-6-jic23@kernel.org
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/iio/magnetometer/rm3100-core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/magnetometer/rm3100-core.c b/drivers/iio/magnetometer/rm3100-core.c
index 7c20918d8108..f31ff225fe61 100644
--- a/drivers/iio/magnetometer/rm3100-core.c
+++ b/drivers/iio/magnetometer/rm3100-core.c
@@ -76,7 +76,8 @@ struct rm3100_data {
bool use_interrupt;
int conversion_time;
int scale;
- u8 buffer[RM3100_SCAN_BYTES];
+ /* Ensure naturally aligned timestamp */
+ u8 buffer[RM3100_SCAN_BYTES] __aligned(8);
struct iio_trigger *drdy_trig;
/*
--
2.30.2
Powered by blists - more mailing lists