From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935554AbdJQMHQ (ORCPT ); Tue, 17 Oct 2017 08:07:16 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8501 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932913AbdJQMHP (ORCPT ); Tue, 17 Oct 2017 08:07:15 -0400 From: Wei Yongjun To: Joerg Roedel CC: Wei Yongjun , , Subject: [PATCH -next] iommu/ipmmu-vmsa: Fix return value check in ipmmu_find_group_dma() Date: Tue, 17 Oct 2017 12:11:22 +0000 Message-ID: <1508242282-73764-1-git-send-email-weiyongjun1@huawei.com> X-Mailer: git-send-email 1.8.3.1 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.59E5F270.0178,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 6147cf4df198b453635cf96c7cd177de Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case of error, the function iommu_group_get() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: 3ae47292024f ("iommu/ipmmu-vmsa: Add new IOMMU_DOMAIN_DMA ops") Signed-off-by: Wei Yongjun --- drivers/iommu/ipmmu-vmsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index af81400..00e88a8 100644 --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ipmmu-vmsa.c @@ -871,7 +871,7 @@ static struct iommu_group *ipmmu_find_group_dma(struct device *dev) sibling = ipmmu_find_sibling_device(dev); if (sibling) group = iommu_group_get(sibling); - if (!sibling || IS_ERR(group)) + if (!sibling || !group) group = generic_device_group(dev); return group;