diff options
author | Sakari Ailus <sakari.ailus@iki.fi> | 2012-01-27 05:18:51 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-08 12:50:51 -0400 |
commit | a32f2f90543853449f0e49eaf885e8d24d5809a7 (patch) | |
tree | f4d2cef9bc4575918be7d2be24e3a8ba9a3e4de8 /drivers/media/video/omap3isp/isp.c | |
parent | 1567bb7dcc6a232693143fdbe3b89791f20890ac (diff) |
[media] omap3isp: Prevent crash at module unload
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.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/omap3isp/isp.c')
-rw-r--r-- | 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 3db8583497ee..06afbc14f6ae 100644 --- a/drivers/media/video/omap3isp/isp.c +++ b/drivers/media/video/omap3isp/isp.c | |||
@@ -1509,7 +1509,8 @@ void omap3isp_put(struct isp_device *isp) | |||
1509 | BUG_ON(isp->ref_count == 0); | 1509 | BUG_ON(isp->ref_count == 0); |
1510 | if (--isp->ref_count == 0) { | 1510 | if (--isp->ref_count == 0) { |
1511 | isp_disable_interrupts(isp); | 1511 | isp_disable_interrupts(isp); |
1512 | isp_save_ctx(isp); | 1512 | if (isp->domain) |
1513 | isp_save_ctx(isp); | ||
1513 | /* Reset the ISP if an entity has failed to stop. This is the | 1514 | /* Reset the ISP if an entity has failed to stop. This is the |
1514 | * only way to recover from such conditions. | 1515 | * only way to recover from such conditions. |
1515 | */ | 1516 | */ |
@@ -1996,6 +1997,7 @@ static int isp_remove(struct platform_device *pdev) | |||
1996 | omap3isp_get(isp); | 1997 | omap3isp_get(isp); |
1997 | iommu_detach_device(isp->domain, &pdev->dev); | 1998 | iommu_detach_device(isp->domain, &pdev->dev); |
1998 | iommu_domain_free(isp->domain); | 1999 | iommu_domain_free(isp->domain); |
2000 | isp->domain = NULL; | ||
1999 | omap3isp_put(isp); | 2001 | omap3isp_put(isp); |
2000 | 2002 | ||
2001 | free_irq(isp->irq_num, isp); | 2003 | free_irq(isp->irq_num, isp); |