Browse Source

iommu/vt-d: Check return value of acpi_bus_get_device()

Checking adev == NULL is not sufficient as
acpi_bus_get_device() might not touch the value of this
parameter in an error case, so check the return value
directly.

Fixes: ed40356b5fcf1ce28e026ab39c5b2b6939068b50
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Joerg Roedel 11 years ago
parent
commit
c0df975f90
1 changed files with 1 additions and 2 deletions
  1. 1 2
      drivers/iommu/dmar.c

+ 1 - 2
drivers/iommu/dmar.c

@@ -678,8 +678,7 @@ static int __init dmar_acpi_dev_scope_init(void)
 				       andd->device_name);
 				       andd->device_name);
 				continue;
 				continue;
 			}
 			}
-			acpi_bus_get_device(h, &adev);
-			if (!adev) {
+			if (acpi_bus_get_device(h, &adev)) {
 				pr_err("Failed to get device for ACPI object %s\n",
 				pr_err("Failed to get device for ACPI object %s\n",
 				       andd->device_name);
 				       andd->device_name);
 				continue;
 				continue;