]> git.baikalelectronics.ru Git - kernel.git/commit
dmaengine: mic_x100_dma: use devm_kzalloc to fix an issue
authorHuang Shijie <sjhuang@iluvatar.ai>
Wed, 22 Aug 2018 02:40:27 +0000 (10:40 +0800)
committerVinod Koul <vkoul@kernel.org>
Mon, 27 Aug 2018 05:46:04 +0000 (11:16 +0530)
commitf8883e6e283efc820f0da7b1aa2afa67fe8400c4
tree8f50bd17840261c04a0853ff21a4e083204b7f25
parentf030a7bb7b1f7de16c1c716a587185e209e25800
dmaengine: mic_x100_dma: use devm_kzalloc to fix an issue

The following patch introduced an issue.
    commit 80eb6a2c928e ("dmaengine: mic_x100_dma: use the new helper to simplify the code")

This issue is :

kfree(mic_dma_dev)
.....
dma_async_device_unregister(mic_dma_dev->device);

Free the memory, and use it again.

So use devm_kzalloc to allocate mic_dma_dev to fix it.

When the Devres try to release the resources, it will call release at the
following order:

dma_async_device_unregister(mic_dma_dev->device);
.....
kfree(mic_dma_dev)

Fixes: 80eb6a2c928e ("dmaengine: mic_x100_dma: use the new helper to simplify the code")
Signed-off-by: Huang Shijie <sjhuang@iluvatar.ai>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/mic_x100_dma.c