* [patch -next] iommu: checking for NULL instead of IS_ERR
@ 2015-06-10 10:59 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2015-06-10 10:59 UTC (permalink / raw)
To: Joerg Roedel; +Cc: iommu, kernel-janitors
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);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [patch -next] iommu: checking for NULL instead of IS_ERR
@ 2015-06-10 10:59 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2015-06-10 10:59 UTC (permalink / raw)
To: Joerg Roedel; +Cc: iommu, kernel-janitors
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);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch -next] iommu: checking for NULL instead of IS_ERR
2015-06-10 10:59 ` Dan Carpenter
@ 2015-06-11 7:43 ` Joerg Roedel
-1 siblings, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2015-06-11 7:43 UTC (permalink / raw)
To: Dan Carpenter; +Cc: iommu, kernel-janitors
On Wed, Jun 10, 2015 at 01:59:27PM +0300, Dan Carpenter wrote:
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch -next] iommu: checking for NULL instead of IS_ERR
@ 2015-06-11 7:43 ` Joerg Roedel
0 siblings, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2015-06-11 7:43 UTC (permalink / raw)
To: Dan Carpenter; +Cc: iommu, kernel-janitors
On Wed, Jun 10, 2015 at 01:59:27PM +0300, Dan Carpenter wrote:
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-11 7:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-10 10:59 [patch -next] iommu: checking for NULL instead of IS_ERR Dan Carpenter
2015-06-10 10:59 ` Dan Carpenter
2015-06-11 7:43 ` Joerg Roedel
2015-06-11 7:43 ` Joerg Roedel
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.