From: Wei Yongjun Subject: [PATCH -next] vfio/type1: fix error return code in vfio_iommu_type1_attach_group() Date: Thu, 9 Feb 2017 16:01:58 +0000 Message-ID: <20170209160158.24497-1-weiyj.lk@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Wei Yongjun , kvm@vger.kernel.org To: Alex Williamson , Eric Auger , Will Deacon Return-path: Received: from mail-pf0-f195.google.com ([209.85.192.195]:34788 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753491AbdBIQC3 (ORCPT ); Thu, 9 Feb 2017 11:02:29 -0500 Received: by mail-pf0-f195.google.com with SMTP id y143so483206pfb.1 for ; Thu, 09 Feb 2017 08:02:04 -0800 (PST) Sender: kvm-owner@vger.kernel.org List-ID: From: Wei Yongjun 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 --- drivers/vfio/vfio_iommu_type1.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 0f353f5..bd6f293 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -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);