]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
vfio/type1: Fix error return code in vfio_iommu_type1_attach_group()
authorWei Yongjun <weiyongjun1@huawei.com>
Thu, 9 Feb 2017 16:01:58 +0000 (16:01 +0000)
committerJoerg Roedel <jroedel@suse.de>
Fri, 10 Feb 2017 14:09:11 +0000 (15:09 +0100)
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 5d704992189f ("vfio/type1: Allow transparent MSI IOVA allocation")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/vfio/vfio_iommu_type1.c

index 0f353f5195747e7a3589666fb81d469664773a19..bd6f293c4ebd59b5f283ebc1193767c982e1f1ef 100644 (file)
@@ -1332,8 +1332,11 @@ static int vfio_iommu_type1_attach_group(void *iommu_data,
        if (ret)
                goto out_detach;
 
-       if (resv_msi && iommu_get_msi_cookie(domain->domain, resv_msi_base))
-               goto out_detach;
+       if (resv_msi) {
+               ret = iommu_get_msi_cookie(domain->domain, resv_msi_base);
+               if (ret)
+                       goto out_detach;
+       }
 
        list_add(&domain->next, &iommu->domain_list);