From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCH -next] iommu/tegra-smmu: Fix return value check in tegra_smmu_group_get() Date: Wed, 20 Dec 2017 09:44:00 -0700 Message-ID: <20171220094400.5b95004f@t450s.home> References: <1513739169-122341-1-git-send-email-weiyongjun1@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1513739169-122341-1-git-send-email-weiyongjun1-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Wei Yongjun Cc: Hiroshi Doyu , Joerg Roedel , Thierry Reding , Jonathan Hunter , linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org List-Id: iommu@lists.linux-foundation.org On Wed, 20 Dec 2017 03:06:09 +0000 Wei Yongjun wrote: > In case of error, the function iommu_group_alloc() returns ERR_PTR() and > never returns NULL. The NULL test in the return value check should be > replaced with IS_ERR(). > > Fixes: 7f4c9176f760 ("iommu/tegra: Allow devices to be grouped") > Signed-off-by: Wei Yongjun > --- > drivers/iommu/tegra-smmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c > index 8885635..44d40bc 100644 > --- a/drivers/iommu/tegra-smmu.c > +++ b/drivers/iommu/tegra-smmu.c > @@ -832,7 +832,7 @@ static struct iommu_group *tegra_smmu_group_get(struct tegra_smmu *smmu, > group->soc = soc; > > group->group = iommu_group_alloc(); > - if (!group->group) { > + if (IS_ERR(group->group)) { > devm_kfree(smmu->dev, group); > mutex_unlock(&smmu->lock); > return NULL; Acked-by: Alex Williamson Thierry, I assume you'll add this on top of the referenced commit. Thanks, Alex