Commit 4d5cf10b authored by Zheng Zengkai's avatar Zheng Zengkai
Browse files

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: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: default avatarHanjun Guo <guohanjun@huawei.com>
parent c17f94c4
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -4995,8 +4995,10 @@ static int __init probe_acpi_namespace_devices(void)
				}

				iommu = device_to_iommu(dev, &bus, &devfn);
				if (!iommu)
					return -ENODEV;
				if (!iommu) {
					ret = -ENODEV;
					goto unlock;
				}
				info = dmar_search_domain_by_dev_info(iommu->segment, bus, devfn);
				if (!info) {
					pn->dev->bus->iommu_ops = &intel_iommu_ops;
@@ -5011,8 +5013,10 @@ static int __init probe_acpi_namespace_devices(void)
			}
			if (!pn_dev) {
				iommu = device_to_iommu(dev, &bus, &devfn);
				if (!iommu)
					return -ENODEV;
				if (!iommu) {
					ret = -ENODEV;
					goto unlock;
				}
				info = dmar_search_domain_by_dev_info(iommu->segment, bus, devfn);
				if (!info) {
					dev->bus->iommu_ops = &intel_iommu_ops;