iommu_domain_free() was called in isp_remove() before omap3isp_put().
omap3isp_put() must not save the context if the IOMMU no longer is there.
Fix this.

Signed-off-by: Sakari Ailus <sakari.ai...@iki.fi>
---
Compared to v1, neither the ISP context is saved.

 drivers/media/video/omap3isp/isp.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/omap3isp/isp.c 
b/drivers/media/video/omap3isp/isp.c
index 12d5f92..d4e0905 100644
--- a/drivers/media/video/omap3isp/isp.c
+++ b/drivers/media/video/omap3isp/isp.c
@@ -1495,7 +1495,8 @@ void omap3isp_put(struct isp_device *isp)
        BUG_ON(isp->ref_count == 0);
        if (--isp->ref_count == 0) {
                isp_disable_interrupts(isp);
-               isp_save_ctx(isp);
+               if (isp->domain)
+                       isp_save_ctx(isp);
                if (isp->needs_reset) {
                        isp_reset(isp);
                        isp->needs_reset = false;
@@ -1981,6 +1982,7 @@ static int isp_remove(struct platform_device *pdev)
        omap3isp_get(isp);
        iommu_detach_device(isp->domain, &pdev->dev);
        iommu_domain_free(isp->domain);
+       isp->domain = NULL;
        omap3isp_put(isp);
 
        free_irq(isp->irq_num, isp);
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to