]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
iio: magn: rm3100: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 13 Jun 2021 15:22:58 +0000 (16:22 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 13 Aug 2021 07:46:16 +0000 (09:46 +0200)
BugLink: https://bugs.launchpad.net/bugs/1938199
[ 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@huawei.com>
Cc: Song Qiang <songqiang1304521@gmail.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613152301.571002-6-jic23@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/iio/magnetometer/rm3100-core.c

index 7c20918d81086f3e6126002b6e1f337a6780479c..f31ff225fe61669ffade1635c7982f57e3d60e1e 100644 (file)
@@ -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;
 
        /*