iommu: Return ERR_PTR() values from device_group call-backs
authorJoerg Roedel <jroedel@suse.de>
Wed, 28 Jun 2017 10:45:31 +0000 (12:45 +0200)
committerJoerg Roedel <jroedel@suse.de>
Wed, 28 Jun 2017 11:29:45 +0000 (13:29 +0200)
The generic device_group call-backs in iommu.c return NULL
in case of error. Since they are getting ERR_PTR values from
iommu_group_alloc(), just pass them up instead.

Reported-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iommu.c

index cf7ca7e70777d6498f751fac98bc29fef9ba8ce6..de09e1e35830f7e3481af6c2b8ab19ded585a822 100644 (file)
@@ -915,13 +915,7 @@ static int get_pci_alias_or_group(struct pci_dev *pdev, u16 alias, void *opaque)
  */
 struct iommu_group *generic_device_group(struct device *dev)
 {
-       struct iommu_group *group;
-
-       group = iommu_group_alloc();
-       if (IS_ERR(group))
-               return NULL;
-
-       return group;
+       return iommu_group_alloc();
 }
 
 /*
@@ -988,11 +982,7 @@ struct iommu_group *pci_device_group(struct device *dev)
                return group;
 
        /* No shared group found, allocate new */
-       group = iommu_group_alloc();
-       if (IS_ERR(group))
-               return NULL;
-
-       return group;
+       return iommu_group_alloc();
 }
 
 /**