From: Auger Eric Subject: Re: [PATCH -next] vfio/type1: fix error return code in vfio_iommu_type1_attach_group() Date: Thu, 9 Feb 2017 18:03:47 +0100 Message-ID: <98b720c2-3f2a-0418-abb0-77b45b50a9ff@redhat.com> References: <20170209160158.24497-1-weiyj.lk@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: Wei Yongjun , kvm@vger.kernel.org To: Wei Yongjun , Alex Williamson , Will Deacon Return-path: Received: from mx1.redhat.com ([209.132.183.28]:57510 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753087AbdBIRMQ (ORCPT ); Thu, 9 Feb 2017 12:12:16 -0500 In-Reply-To: <20170209160158.24497-1-weiyj.lk@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Hi Wei, On 09/02/2017 17:01, Wei Yongjun wrote: > 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 Reviewed-by: Eric Auger Thanks for spotting this. Eric > --- > 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); >