Skip to content

Commit 0d58a72

Browse files
tititiou36Hans Verkuil
authored andcommitted
media: rkvdec: Fix an error handling path in rkvdec_probe()
If an error occurs after a successful iommu_paging_domain_alloc() call, it should be undone by a corresponding iommu_domain_free() call, as already done in the remove function. In order to fix the issue, move the corresponding call at the end of the function, because it is safe to allocate 'empty_domain' later. Fixes: ff8c562 ("media: rkvdec: Restore iommu addresses on errors") Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Nicolas Dufresne <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 6347dc7 commit 0d58a72

File tree

1 file changed

+9
-9
lines changed
  • drivers/media/platform/rockchip/rkvdec

1 file changed

+9
-9
lines changed

drivers/media/platform/rockchip/rkvdec/rkvdec.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,15 +1159,6 @@ static int rkvdec_probe(struct platform_device *pdev)
11591159
return ret;
11601160
}
11611161

1162-
if (iommu_get_domain_for_dev(&pdev->dev)) {
1163-
rkvdec->empty_domain = iommu_paging_domain_alloc(rkvdec->dev);
1164-
1165-
if (IS_ERR(rkvdec->empty_domain)) {
1166-
rkvdec->empty_domain = NULL;
1167-
dev_warn(rkvdec->dev, "cannot alloc new empty domain\n");
1168-
}
1169-
}
1170-
11711162
vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
11721163

11731164
irq = platform_get_irq(pdev, 0);
@@ -1190,6 +1181,15 @@ static int rkvdec_probe(struct platform_device *pdev)
11901181
if (ret)
11911182
goto err_disable_runtime_pm;
11921183

1184+
if (iommu_get_domain_for_dev(&pdev->dev)) {
1185+
rkvdec->empty_domain = iommu_paging_domain_alloc(rkvdec->dev);
1186+
1187+
if (IS_ERR(rkvdec->empty_domain)) {
1188+
rkvdec->empty_domain = NULL;
1189+
dev_warn(rkvdec->dev, "cannot alloc new empty domain\n");
1190+
}
1191+
}
1192+
11931193
return 0;
11941194

11951195
err_disable_runtime_pm:

0 commit comments

Comments
 (0)