Merge tag 'remoteproc-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad...
[firefly-linux-kernel-4.4.55.git] / drivers / remoteproc / ste_modem_rproc.c
index 6fc2139481461ae1fc450688380fb16055dea247..1ec39a4c0b3edbd9a6c64ef95e22649ab6ca7de7 100644 (file)
@@ -255,6 +255,8 @@ static int sproc_drv_remove(struct platform_device *pdev)
 
        /* Unregister as remoteproc device */
        rproc_del(sproc->rproc);
+       dma_free_coherent(sproc->rproc->dev.parent, SPROC_FW_SIZE,
+                         sproc->fw_addr, sproc->fw_dma_addr);
        rproc_put(sproc->rproc);
 
        mdev->drv_data = NULL;
@@ -312,10 +314,13 @@ static int sproc_probe(struct platform_device *pdev)
        /* Register as a remoteproc device */
        err = rproc_add(rproc);
        if (err)
-               goto free_rproc;
+               goto free_mem;
 
        return 0;
 
+free_mem:
+       dma_free_coherent(rproc->dev.parent, SPROC_FW_SIZE,
+                         sproc->fw_addr, sproc->fw_dma_addr);
 free_rproc:
        /* Reset device data upon error */
        mdev->drv_data = NULL;