[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <962f14e6-9b6b-47a4-9751-fa017399e563@baylibre.com>
Date: Tue, 17 Dec 2024 10:14:56 -0600
From: David Lechner <dlechner@...libre.com>
To: Matteo Martelli <matteomartelli3@...il.com>,
Jonathan Cameron <jic23@...nel.org>, Lars-Peter Clausen <lars@...afoo.de>,
Peter Rosin <peda@...ntia.se>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] iio: iio-mux: kzalloc instead of devm_kzalloc to
ensure page alignment
On 12/2/24 9:11 AM, Matteo Martelli wrote:
> During channel configuration, the iio-mux driver allocates a page with
> devm_kzalloc(PAGE_SIZE) to read channel ext_info. However, the resulting
> buffer points to an offset of the page due to the devres header sitting
> at the beginning of the allocated area. This leads to failure in the
> provider driver when sysfs_emit* helpers are used to format the ext_info
> attributes.
>
> Switch to plain kzalloc version. The devres version is not strictly
> necessary as the buffer is only accessed during the channel
> configuration phase. Rely on __free cleanup to deallocate the buffer.
> Also, move the ext_info handling into a new function to have the page
> buffer definition and assignment in one statement as suggested by
> cleanup documentation.
>
> Signed-off-by: Matteo Martelli <matteomartelli3@...il.com>
> ---
Reviewed-by: David Lechner <dlechner@...libre.com>
Powered by blists - more mailing lists