linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Varun Sethi <Varun.Sethi@freescale.com>
To: <iommu@lists.linux-foundation.org>, <joro@8bytes.org>,
	<linux-kernel@vger.kernel.org>, <linuxppc-dev@lists.ozlabs.org>,
	<alex.williamson@redhat.com>
Cc: Varun Sethi <Varun.Sethi@freescale.com>
Subject: [PATCH 3/3] iommu/fsl: Fix the error condition during iommu group
Date: Tue, 24 Jun 2014 19:27:17 +0530	[thread overview]
Message-ID: <1403618237-26248-4-git-send-email-Varun.Sethi@freescale.com> (raw)
In-Reply-To: <1403618237-26248-1-git-send-email-Varun.Sethi@freescale.com>

Earlier PTR_ERR was being returned even if group was set to null.
Now, we explicitly set an ERR_PTR value in case the group  pointer is
NULL.

Signed-off-by: Varun Sethi <Varun.Sethi@freescale.com>
---
 drivers/iommu/fsl_pamu_domain.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
index 54060d1..af47648 100644
--- a/drivers/iommu/fsl_pamu_domain.c
+++ b/drivers/iommu/fsl_pamu_domain.c
@@ -1037,12 +1037,15 @@ root_bus:
 			group = get_shared_pci_device_group(pdev);
 	}
 
+	if (!group)
+		group = ERR_PTR(-ENODEV);
+
 	return group;
 }
 
 static int fsl_pamu_add_device(struct device *dev)
 {
-	struct iommu_group *group = NULL;
+	struct iommu_group *group = ERR_PTR(-ENODEV);
 	struct pci_dev *pdev;
 	const u32 *prop;
 	int ret, len;
@@ -1065,7 +1068,7 @@ static int fsl_pamu_add_device(struct device *dev)
 			group = get_device_iommu_group(dev);
 	}
 
-	if (!group || IS_ERR(group))
+	if (IS_ERR(group))
 		return PTR_ERR(group);
 
 	ret = iommu_group_add_device(group, dev);
-- 
1.7.9.5

  parent reply	other threads:[~2014-06-24 18:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24 13:57 [PATCH 0/3] iommu/fsl: Fixes for the PAMU driver Varun Sethi
2014-06-24 13:57 ` [PATCH 1/3] iommu/fsl: Fix PAMU window size check Varun Sethi
2014-07-04 10:44   ` Joerg Roedel
2014-07-04 12:47     ` Varun Sethi
2014-06-24 13:57 ` [PATCH 2/3] iommu/fsl: Fix the device domain attach condition Varun Sethi
2014-07-04 10:54   ` Joerg Roedel
2014-07-04 12:50     ` Varun Sethi
2014-06-24 13:57 ` Varun Sethi [this message]
     [not found] ` <1403618237-26248-2-git-send-email-Varun.Sethi__13822.953499812$1403630309$gmane$org@freescale.com>
2014-07-02  7:46   ` [PATCH 1/3] iommu/fsl: Fix PAMU window size check Emil Medve
2014-07-02  8:58     ` Varun Sethi
2014-07-07  8:32 ` [PATCH 0/3] iommu/fsl: Fixes for the PAMU driver Joerg Roedel
2014-07-07  8:55   ` Varun Sethi

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=1403618237-26248-4-git-send-email-Varun.Sethi@freescale.com \
    --to=varun.sethi@freescale.com \
    --cc=alex.williamson@redhat.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).