]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - drivers/dma/dw/platform.c
dmaengine: dw: fix potential memory leak in dw_dma_parse_dt()
authorMans Rullgard <mans@mansr.com>
Thu, 17 Dec 2015 23:30:57 +0000 (23:30 +0000)
committerVinod Koul <vinod.koul@intel.com>
Fri, 18 Dec 2015 05:29:32 +0000 (10:59 +0530)
commit2b574ba9c50a06a1aa6cf908cd44119367111006
tree5a4790db10d60ecc2befac8daea55252c4ba334d
parent9ff68186eaac415bfc0b84d627b7ecec24b0c52d
dmaengine: dw: fix potential memory leak in dw_dma_parse_dt()

If the "dma-channels" DT property is missing, the dw_dma_parse_dt()
function return NULL, but not before allocating memory for a struct
dw_dma_platform_data through devres.  If the device supports parameter
detection, the probe still succeeds and the allocated memory is not
released until the device is removed.

Fix this by deferring the allocation until after checking the
"dma-channels" property.

Signed-off-by: Mans Rullgard <mans@mansr.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/dw/platform.c