Commit c08934a6 authored by Johan Hovold's avatar Johan Hovold Committed by Joerg Roedel
Browse files

iommu/tegra: fix device leak on probe_device()



Make sure to drop the reference taken to the iommu platform device when
looking up its driver data during probe_device().

Note that commit 9826e393 ("iommu/tegra-smmu: Fix missing
put_device() call in tegra_smmu_find") fixed the leak in an error path,
but the reference is still leaking on success.

Fixes: 89184651 ("memory: Add NVIDIA Tegra memory controller support")
Cc: stable@vger.kernel.org	# 3.19: 9826e393
Cc: Miaoqian Lin <linmq006@gmail.com>
Acked-by: default avatarRobin Murphy <robin.murphy@arm.com>
Acked-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
parent f916109b
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -830,10 +830,9 @@ static struct tegra_smmu *tegra_smmu_find(struct device_node *np)
		return NULL;

	mc = platform_get_drvdata(pdev);
	if (!mc) {
	put_device(&pdev->dev);
	if (!mc)
		return NULL;
	}

	return mc->smmu;
}