From: Martin Sperl <kernel@xxxxxxxxxxxxxxxx> There was a bug detected with the place where spi_res_release is executed, which was solved by commit c9ba7a16d0f1 ("spi: Release spi_res after finalizing message") but then reverted because of a race condition. During the investigation it became also apparent that there are also error cases that are not propperly handled with the correct sequence. So this patchset tries to solve of the issues: * fix the root problem codifying the "sequence" more explicitly * give a warning about possible inconsistent behaviour * make the "sequencing" better enforced by using spi_res to guarantee ordering. In the future spi_unmap_dma can also get converted to use spi_res for unmapping. For most practical purposes it may be recommended to apply patch 1+2 now to avoid having to revert commit 8b7bd10eb00d ("spi/spi-bcm2835: Split transfers that exceed DLEN"). Patch 3 can go into a later release if preferred. Martin Sperl (3): spi: core: resource: fix memory leak on error and place in "correct" sequence spi: core: add a warning when prepare_message uses spi_res and is unprepared spi: core: make unprepare_message part of spi_message.resource process drivers/spi/spi.c | 53 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 12 deletions(-) -- 2.11.0