提交 f35f4e62 编写于 作者: Z Zheng Zengkai

iommu: Fix error handling in probe_acpi_namespace_devices()

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I65QZY

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

Fix smatch error in probe_acpi_namespace_devices().

In probe_acpi_namespace_devices(), if device_to_iommu() returns NULL,
unlock operation is needed before return.

Fixes: d6602228 ("iommu/vt-d:Add support for detecting ACPI device, in RMRR")
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
上级 d42422fd
...@@ -4995,8 +4995,10 @@ static int __init probe_acpi_namespace_devices(void) ...@@ -4995,8 +4995,10 @@ static int __init probe_acpi_namespace_devices(void)
} }
iommu = device_to_iommu(dev, &bus, &devfn); iommu = device_to_iommu(dev, &bus, &devfn);
if (!iommu) if (!iommu) {
return -ENODEV; ret = -ENODEV;
goto unlock;
}
info = dmar_search_domain_by_dev_info(iommu->segment, bus, devfn); info = dmar_search_domain_by_dev_info(iommu->segment, bus, devfn);
if (!info) { if (!info) {
pn->dev->bus->iommu_ops = &intel_iommu_ops; pn->dev->bus->iommu_ops = &intel_iommu_ops;
...@@ -5011,8 +5013,10 @@ static int __init probe_acpi_namespace_devices(void) ...@@ -5011,8 +5013,10 @@ static int __init probe_acpi_namespace_devices(void)
} }
if (!pn_dev) { if (!pn_dev) {
iommu = device_to_iommu(dev, &bus, &devfn); iommu = device_to_iommu(dev, &bus, &devfn);
if (!iommu) if (!iommu) {
return -ENODEV; ret = -ENODEV;
goto unlock;
}
info = dmar_search_domain_by_dev_info(iommu->segment, bus, devfn); info = dmar_search_domain_by_dev_info(iommu->segment, bus, devfn);
if (!info) { if (!info) {
dev->bus->iommu_ops = &intel_iommu_ops; dev->bus->iommu_ops = &intel_iommu_ops;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册