iio: iio-mux: kzalloc instead of devm_kzalloc to ensure page alignment
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@gmail.com> Fixes: 7ba9df54 ("iio: multiplexer: new iio category and iio-mux driver") Reviewed-by:
David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20241202-iio-kmalloc-align-v1-2-aa9568c03937@gmail.com Signed-off-by:
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Loading
Please sign in to comment