Re: [PATCH v3 1/4] iio: adc: ad799x: make rx_buf static and DMA-safe

From: David Lechner

Date: Mon Mar 02 2026 - 11:47:56 EST


On 3/2/26 7:06 AM, Archit Anant wrote:
> Currently, rx_buf is dynamically allocated using kmalloc() every time
> ad799x_update_scan_mode() is called. This can lead to memory leaks if
> the scan mask is updated multiple times.
>
> Drop the dynamic allocation and replace it with a static, buffer at the
> end of the state structure using IIO_DECLARE_DMA_BUFFER_WITH_TS().
> This eliminates the allocation overhead, prevents leaks, and removes
> the need for manual kfree() on driver removal.
>
See replies in v1 and v2. DMA-safe is not important because it is I2C.