Browse Source

video: driver: add sanity check for iommu domain

Ensure the associated iommu domain is valid for the given
context bank. Error out if there is no valid domain.

Change-Id: I0ac601cc9bf306811145663e4a6ca293c0a3e3cb
Signed-off-by: Vikash Garodia <[email protected]>
Vikash Garodia 2 years ago
parent
commit
1a42efcaef
1 changed files with 4 additions and 0 deletions
  1. 4 0
      driver/vidc/src/msm_vidc_probe.c

+ 4 - 0
driver/vidc/src/msm_vidc_probe.c

@@ -375,6 +375,10 @@ static int msm_vidc_setup_context_bank(struct msm_vidc_core *core,
 	/* populate dev & domain field */
 	/* populate dev & domain field */
 	cb->dev = dev;
 	cb->dev = dev;
 	cb->domain = iommu_get_domain_for_dev(cb->dev);
 	cb->domain = iommu_get_domain_for_dev(cb->dev);
+	if (!cb->domain) {
+		d_vpr_e("%s: Failed to get iommu domain for %s\n", __func__, dev_name(dev));
+		return -EIO;
+	}
 
 
 	if (cb->dma_mask) {
 	if (cb->dma_mask) {
 		rc = dma_set_mask_and_coherent(cb->dev, cb->dma_mask);
 		rc = dma_set_mask_and_coherent(cb->dev, cb->dma_mask);