Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a32f2f90 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab
Browse files

[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: default avatarSakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 1567bb7d
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -1509,6 +1509,7 @@ void omap3isp_put(struct isp_device *isp)
	BUG_ON(isp->ref_count == 0);
	BUG_ON(isp->ref_count == 0);
	if (--isp->ref_count == 0) {
	if (--isp->ref_count == 0) {
		isp_disable_interrupts(isp);
		isp_disable_interrupts(isp);
		if (isp->domain)
			isp_save_ctx(isp);
			isp_save_ctx(isp);
		/* Reset the ISP if an entity has failed to stop. This is the
		/* Reset the ISP if an entity has failed to stop. This is the
		 * only way to recover from such conditions.
		 * only way to recover from such conditions.
@@ -1996,6 +1997,7 @@ static int isp_remove(struct platform_device *pdev)
	omap3isp_get(isp);
	omap3isp_get(isp);
	iommu_detach_device(isp->domain, &pdev->dev);
	iommu_detach_device(isp->domain, &pdev->dev);
	iommu_domain_free(isp->domain);
	iommu_domain_free(isp->domain);
	isp->domain = NULL;
	omap3isp_put(isp);
	omap3isp_put(isp);


	free_irq(isp->irq_num, isp);
	free_irq(isp->irq_num, isp);