dmaengine: qcom_hidma: release the descriptor before the callback
authorSinan Kaya <okaya@codeaurora.org>
Wed, 31 Aug 2016 15:10:27 +0000 (11:10 -0400)
committerVinod Koul <vinod.koul@intel.com>
Wed, 31 Aug 2016 15:57:32 +0000 (21:27 +0530)
commit8a31f8b5db65b860fd0d358dc27f6daf26074406
tree2464951e1e9b2eaa2930294abe5c2c2b685bb35c
parent73fc45e3ce7838e6f47228dd51144c492931e8ad
dmaengine: qcom_hidma: release the descriptor before the callback

There is a race condition between data transfer callback and descriptor
free code. The callback routine may decide to clear the resources even
though the descriptor has not yet been freed.

Instead of calling the callback first and then releasing the memory,
this code is changing the order to return the descriptor back to the
free pool and then call the user provided callback.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/qcom/hidma.c