提交 4643aef9 编写于 作者: Y Yong Wu 提交者: sanglipeng

iommu/mediatek-v1: Add error handle for mtk_iommu_probe

stable inclusion
from stable-v5.10.164
commit cf38e7624179c93ed60482d795677d491d4b0136
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7T7G4

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=cf38e7624179c93ed60482d795677d491d4b0136

--------------------------------

[ Upstream commit ac304c07 ]

In the original code, we lack the error handle. This patch adds them.
Signed-off-by: NYong Wu <yong.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210412064843.11614-2-yong.wu@mediatek.comSigned-off-by: NJoerg Roedel <jroedel@suse.de>
Stable-dep-of: 142e821f ("iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe()")
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: Nsanglipeng <sanglipeng1@jd.com>
上级 2f33b93d
...@@ -624,12 +624,26 @@ static int mtk_iommu_probe(struct platform_device *pdev) ...@@ -624,12 +624,26 @@ static int mtk_iommu_probe(struct platform_device *pdev)
ret = iommu_device_register(&data->iommu); ret = iommu_device_register(&data->iommu);
if (ret) if (ret)
return ret; goto out_sysfs_remove;
if (!iommu_present(&platform_bus_type)) if (!iommu_present(&platform_bus_type)) {
bus_set_iommu(&platform_bus_type, &mtk_iommu_ops); ret = bus_set_iommu(&platform_bus_type, &mtk_iommu_ops);
if (ret)
goto out_dev_unreg;
}
return component_master_add_with_match(dev, &mtk_iommu_com_ops, match); ret = component_master_add_with_match(dev, &mtk_iommu_com_ops, match);
if (ret)
goto out_bus_set_null;
return ret;
out_bus_set_null:
bus_set_iommu(&platform_bus_type, NULL);
out_dev_unreg:
iommu_device_unregister(&data->iommu);
out_sysfs_remove:
iommu_device_sysfs_remove(&data->iommu);
return ret;
} }
static int mtk_iommu_remove(struct platform_device *pdev) static int mtk_iommu_remove(struct platform_device *pdev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册