• John Stultz's avatar
    k3dma: Fix memory handling in preparation for cyclic mode · 36387a2b
    John Stultz authored
    With cyclic mode, the shared virt-dma logic doesn't actually
    manage the descriptor state, nor the calling of the descriptor
    free callback. This results in leaking a desc structure every
    time we start an audio transfer.
    
    Thus we must manage it ourselves. The k3dma driver already keeps
    track of the active and finished descriptors via ds_run and ds_done
    pointers, so cleanup how we handle those two values, so when we
    tear down everything in terminate_all, call free_desc on the ds_run
    and ds_done pointers if they are not null.
    
    NOTE: HiKey doesn't use the non-cyclic dma modes, so I'm not been
    able to test those modes. But with this patch we no longer leak
    the desc structures.
    
    Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
    Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
    Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
    Cc: Vinod Koul <vinod.koul@intel.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Mark Brown <broonie@kernel.org>
    Cc: Andy Green <andy@warmcat.com>
    Acked-by: default avatarZhangfei Gao <zhangfei.gao@linaro.org>
    Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
    Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
    36387a2b
k3dma.c 21.5 KB