linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Jon Hunter <jonathanh@nvidia.com>
Cc: Hiroshi Doyu <hdoyu@nvidia.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Robin Murphy <robin.murphy@arm.com>,
	iommu@lists.linux-foundation.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org, Joerg Roedel <jroedel@suse.de>
Subject: Re: [PATCH 1/2] iommu/tegra: Add support for struct iommu_device
Date: Wed, 30 Aug 2017 14:09:03 +0200	[thread overview]
Message-ID: <20170830120902.kqtxh2ls4ob7xpwy@8bytes.org> (raw)
In-Reply-To: <f857ad53-66ca-0aa9-947a-f517443d114d@nvidia.com>

Hi Jon,

On Wed, Aug 30, 2017 at 12:04:38PM +0100, Jon Hunter wrote:
> With next-20170829 I am seeing several Tegra boards crashing [0][1] on
> boot in tegra_smmu_probe() and the bisect is point to this commit. Looks
> like there maybe a sequence problem between calls to bus_set_iommu() and
> iommu_device_add_sysfs() which results in a NULL pointer dereference.

Thanks for the report. Can you please test whether the patch below
fixes the problem?

Thanks,

	Joerg

diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index 2802e12e6a54..48ffbe95a663 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -949,10 +949,6 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,
 
 	tegra_smmu_ahb_enable();
 
-	err = bus_set_iommu(&platform_bus_type, &tegra_smmu_ops);
-	if (err < 0)
-		return ERR_PTR(err);
-
 	err = iommu_device_sysfs_add(&smmu->iommu, dev, NULL, dev_name(dev));
 	if (err)
 		return ERR_PTR(err);
@@ -965,6 +961,10 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,
 		return ERR_PTR(err);
 	}
 
+	err = bus_set_iommu(&platform_bus_type, &tegra_smmu_ops);
+	if (err < 0)
+		return ERR_PTR(err);
+
 	if (IS_ENABLED(CONFIG_DEBUG_FS))
 		tegra_smmu_debugfs_init(smmu);
 

  reply	other threads:[~2017-08-30 12:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09 22:29 [PATCH 0/2] iommu/tegra*: Add support for struct iommu_device Joerg Roedel
2017-08-09 22:29 ` [PATCH 1/2] iommu/tegra: " Joerg Roedel
2017-08-18 12:47   ` Thierry Reding
2017-08-30 11:04   ` Jon Hunter
2017-08-30 12:09     ` Joerg Roedel [this message]
2017-08-30 14:22       ` Jon Hunter
2017-08-30 15:30         ` Joerg Roedel
2017-08-30 16:53           ` Jon Hunter
2017-08-31 10:23           ` Jon Hunter
2017-08-09 22:29 ` [PATCH 2/2] iommu/tegra-gart: " Joerg Roedel
2017-08-16 22:21   ` Dmitry Osipenko
2017-08-17 13:52     ` Thierry Reding
2017-08-17 17:17       ` Dmitry Osipenko
2017-08-18 12:47   ` Thierry Reding
2017-08-17 13:58 ` [PATCH 0/2] iommu/tegra*: " Thierry Reding

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=20170830120902.kqtxh2ls4ob7xpwy@8bytes.org \
    --to=joro@8bytes.org \
    --cc=hdoyu@nvidia.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=jroedel@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=thierry.reding@gmail.com \
    /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).