[PATCH v3 04/12] iio: adc: ad_sigma_delta: use sizeof() in ALIGN()

From: David Lechner
Date: Tue Jul 01 2025 - 17:40:31 EST


Use sizeof() instead of hardcoding the size of the timestamp in the
ALIGN() macro. This makes it a bit more obvious what the intention of
the code is.

Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx>
---
drivers/iio/adc/ad_sigma_delta.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c
index 5362157966d89cbf0e602716aaaf0b78f3921b11..dd15c357d1494bf5718e50e50a514cb4d4556f2b 100644
--- a/drivers/iio/adc/ad_sigma_delta.c
+++ b/drivers/iio/adc/ad_sigma_delta.c
@@ -488,7 +488,8 @@ static int ad_sd_buffer_postenable(struct iio_dev *indio_dev)
return ret;
}

- samples_buf_size = ALIGN(slot * indio_dev->channels[0].scan_type.storagebits / 8, 8);
+ samples_buf_size = ALIGN(slot * indio_dev->channels[0].scan_type.storagebits / 8,
+ sizeof(s64));
samples_buf_size += sizeof(s64);
samples_buf = devm_krealloc(&sigma_delta->spi->dev, sigma_delta->samples_buf,
samples_buf_size, GFP_KERNEL);

--
2.43.0