Re: [PATCH v3] iio: st_sensors: drop temporary kmalloc buffer and reuse buffer_data

From: David Lechner

Date: Sat Mar 14 2026 - 16:31:11 EST


On 3/12/26 1:34 AM, Sanjay Chitroda wrote:
> From: Sanjay Chitroda <sanjayembeddedse@xxxxxxxxx>
>
> Replace the per-call kmalloc() scratch buffer with the statically allocated

"statically allocated" is a bit misleading. It is just an existing buffer
in the private driver data (dynamically allocated during probe).

> buffer_data[] field present in struct st_sensor_data. The existing buffer
> is DMA-aligned and sufficiently sized for all channel widths, so using it
> avoids unnecessary dynamic memory allocation on each read.
>
> This simplifies the code, removes redundant allocation and cleanup.
> No functional change intended.
>
> Signed-off-by: Sanjay Chitroda <sanjayembeddedse@xxxxxxxxx>
> ---
Reviewed-by: David Lechner <dlechner@xxxxxxxxxxxx>