On Fri, 4 Nov 2022 at 12:55, Marek Szyprowski <m.szyprowski@xxxxxxxxxxx> wrote: > > Registering SYSMMU platform driver might directly trigger initializing > IOMMU domains and performing initial mappings. That time all common > resources for the SYSMMU driver must be already allocated, so move > platform driver registration to the end of exynos_iommu_init() function. > > Signed-off-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx> > --- Reviewed-by: Sam Protsenko <semen.protsenko@xxxxxxxxxx> Please let me know if you want me to rebase my patches on top of this one. > drivers/iommu/exynos-iommu.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c > index 45fd4850bacb..85a6a775aea5 100644 > --- a/drivers/iommu/exynos-iommu.c > +++ b/drivers/iommu/exynos-iommu.c > @@ -1432,12 +1432,6 @@ static int __init exynos_iommu_init(void) > return -ENOMEM; > } > > - ret = platform_driver_register(&exynos_sysmmu_driver); > - if (ret) { > - pr_err("%s: Failed to register driver\n", __func__); > - goto err_reg_driver; > - } > - > zero_lv2_table = kmem_cache_zalloc(lv2table_kmem_cache, GFP_KERNEL); > if (zero_lv2_table == NULL) { > pr_err("%s: Failed to allocate zero level2 page table\n", > @@ -1446,10 +1440,16 @@ static int __init exynos_iommu_init(void) > goto err_zero_lv2; > } > > + ret = platform_driver_register(&exynos_sysmmu_driver); > + if (ret) { > + pr_err("%s: Failed to register driver\n", __func__); > + goto err_reg_driver; > + } > + > return 0; > -err_zero_lv2: > - platform_driver_unregister(&exynos_sysmmu_driver); > err_reg_driver: > + platform_driver_unregister(&exynos_sysmmu_driver); > +err_zero_lv2: > kmem_cache_destroy(lv2table_kmem_cache); > return ret; > } > -- > 2.17.1 >