Skip to content

Commit e7acc36

Browse files
rmurphy-armwilldeacon
authored andcommitted
iommu/mediatek-v1: Clean up redundant fwspec checks
The driver explicitly clears any existing fwspec before calling mtk_iommu_v1_create_mapping(), but even if it didn't, the checks it's doing there duplicate what iommu_fwspec_init() would do anyway. Clean them up. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/7d6ebec135483f889af00eb376aa31c012efc3b2.1719919669.git.robin.murphy@arm.com Signed-off-by: Will Deacon <[email protected]>
1 parent 83a7eef commit e7acc36

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

drivers/iommu/mtk_iommu_v1.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ static const struct iommu_ops mtk_iommu_v1_ops;
401401
static int mtk_iommu_v1_create_mapping(struct device *dev,
402402
const struct of_phandle_args *args)
403403
{
404-
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
405404
struct mtk_iommu_v1_data *data;
406405
struct platform_device *m4updev;
407406
struct dma_iommu_mapping *mtk_mapping;
@@ -413,14 +412,9 @@ static int mtk_iommu_v1_create_mapping(struct device *dev,
413412
return -EINVAL;
414413
}
415414

416-
if (!fwspec) {
417-
ret = iommu_fwspec_init(dev, &args->np->fwnode, &mtk_iommu_v1_ops);
418-
if (ret)
419-
return ret;
420-
fwspec = dev_iommu_fwspec_get(dev);
421-
} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_v1_ops) {
422-
return -EINVAL;
423-
}
415+
ret = iommu_fwspec_init(dev, &args->np->fwnode, &mtk_iommu_v1_ops);
416+
if (ret)
417+
return ret;
424418

425419
if (!dev_iommu_priv_get(dev)) {
426420
/* Get the m4u device */

0 commit comments

Comments
 (0)