Skip to content

Commit f48dcda

Browse files
rmurphy-armjoergroedel
authored andcommitted
iommu/rockchip: Allocate per-device data sensibly
Now that DT-based probing is finally happening in the right order again, it reveals an issue in Rockchip's of_xlate, which can now be called during registration, but is using the global dma_dev which is only assigned later. However, this makes little sense when we're already looking up the correct IOMMU device, who should logically be the owner of the devm allocation anyway. Reported-by: Marek Szyprowski <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Tested-by: Anders Roxell <[email protected]> Fixes: bcb81ac ("iommu: Get DT/ACPI parsing into the proper probe path") Signed-off-by: Robin Murphy <[email protected]> Tested-by: Quentin Schulz <[email protected]> Tested-by: Dang Huynh <[email protected]> Reviewed-by: Nicolas Frattaroli <[email protected]> Tested-by: Nicolas Frattaroli <[email protected]> Link: https://lore.kernel.org/r/771e91cf16b3048e93f657153b76905665878fa2.1741886382.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <[email protected]>
1 parent 0ad2507 commit f48dcda

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/iommu/rockchip-iommu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,12 +1148,12 @@ static int rk_iommu_of_xlate(struct device *dev,
11481148
struct platform_device *iommu_dev;
11491149
struct rk_iommudata *data;
11501150

1151-
data = devm_kzalloc(dma_dev, sizeof(*data), GFP_KERNEL);
1151+
iommu_dev = of_find_device_by_node(args->np);
1152+
1153+
data = devm_kzalloc(&iommu_dev->dev, sizeof(*data), GFP_KERNEL);
11521154
if (!data)
11531155
return -ENOMEM;
11541156

1155-
iommu_dev = of_find_device_by_node(args->np);
1156-
11571157
data->iommu = platform_get_drvdata(iommu_dev);
11581158
data->iommu->domain = &rk_identity_domain;
11591159
dev_iommu_priv_set(dev, data);

0 commit comments

Comments
 (0)