From: Dan Carpenter <dan.carpenter@oracle.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org, kernel-janitors@vger.kernel.org
Subject: [patch -next] iommu: checking for NULL instead of IS_ERR
Date: Wed, 10 Jun 2015 10:59:27 +0000 [thread overview]
Message-ID: <20150610105926.GA21772@mwanda> (raw)
The iommu_group_alloc() and iommu_group_get_for_dev() functions return
error pointers, they never return NULL.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index c520c0c..9c25e6be 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -788,15 +788,16 @@ static struct iommu_group *iommu_group_get_for_pci_dev(struct pci_dev *pdev)
/* No shared group found, allocate new */
group = iommu_group_alloc();
- if (group) {
- /*
- * Try to allocate a default domain - needs support from the
- * IOMMU driver.
- */
- group->default_domain = __iommu_domain_alloc(pdev->dev.bus,
- IOMMU_DOMAIN_DMA);
- group->domain = group->default_domain;
- }
+ if (IS_ERR(group))
+ return NULL;
+
+ /*
+ * Try to allocate a default domain - needs support from the
+ * IOMMU driver.
+ */
+ group->default_domain = __iommu_domain_alloc(pdev->dev.bus,
+ IOMMU_DOMAIN_DMA);
+ group->domain = group->default_domain;
return group;
}
@@ -1548,8 +1549,8 @@ int iommu_request_dm_for_dev(struct device *dev)
/* Device must already be in a group before calling this function */
group = iommu_group_get_for_dev(dev);
- if (!group)
- return -EINVAL;
+ if (IS_ERR(group))
+ return PTR_ERR(group);
mutex_lock(&group->mutex);
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org, kernel-janitors@vger.kernel.org
Subject: [patch -next] iommu: checking for NULL instead of IS_ERR
Date: Wed, 10 Jun 2015 13:59:27 +0300 [thread overview]
Message-ID: <20150610105926.GA21772@mwanda> (raw)
The iommu_group_alloc() and iommu_group_get_for_dev() functions return
error pointers, they never return NULL.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index c520c0c..9c25e6be 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -788,15 +788,16 @@ static struct iommu_group *iommu_group_get_for_pci_dev(struct pci_dev *pdev)
/* No shared group found, allocate new */
group = iommu_group_alloc();
- if (group) {
- /*
- * Try to allocate a default domain - needs support from the
- * IOMMU driver.
- */
- group->default_domain = __iommu_domain_alloc(pdev->dev.bus,
- IOMMU_DOMAIN_DMA);
- group->domain = group->default_domain;
- }
+ if (IS_ERR(group))
+ return NULL;
+
+ /*
+ * Try to allocate a default domain - needs support from the
+ * IOMMU driver.
+ */
+ group->default_domain = __iommu_domain_alloc(pdev->dev.bus,
+ IOMMU_DOMAIN_DMA);
+ group->domain = group->default_domain;
return group;
}
@@ -1548,8 +1549,8 @@ int iommu_request_dm_for_dev(struct device *dev)
/* Device must already be in a group before calling this function */
group = iommu_group_get_for_dev(dev);
- if (!group)
- return -EINVAL;
+ if (IS_ERR(group))
+ return PTR_ERR(group);
mutex_lock(&group->mutex);
next reply other threads:[~2015-06-10 10:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-10 10:59 Dan Carpenter [this message]
2015-06-10 10:59 ` [patch -next] iommu: checking for NULL instead of IS_ERR Dan Carpenter
2015-06-11 7:43 ` Joerg Roedel
2015-06-11 7:43 ` Joerg Roedel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150610105926.GA21772@mwanda \
--to=dan.carpenter@oracle.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.