lkml.org 
[lkml]   [2018]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4/9] iommu/rockchip: Fix error handling in init
    Date
    It's hard to undo bus_set_iommu() in the error path, so move it to the
    end of init call.

    Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
    ---

    drivers/iommu/rockchip-iommu.c | 18 +++++++++++++-----
    1 file changed, 13 insertions(+), 5 deletions(-)

    diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
    index a05844cabb45..5f141390b4d7 100644
    --- a/drivers/iommu/rockchip-iommu.c
    +++ b/drivers/iommu/rockchip-iommu.c
    @@ -1247,17 +1247,25 @@ static int __init rk_iommu_init(void)

    of_node_put(np);

    - ret = bus_set_iommu(&platform_bus_type, &rk_iommu_ops);
    - if (ret)
    - return ret;
    -
    ret = platform_driver_register(&rk_iommu_domain_driver);
    if (ret)
    return ret;

    ret = platform_driver_register(&rk_iommu_driver);
    if (ret)
    - platform_driver_unregister(&rk_iommu_domain_driver);
    + goto err_unreg_domain_drv;
    +
    + ret = bus_set_iommu(&platform_bus_type, &rk_iommu_ops);
    + if (ret)
    + goto err_unreg_iommu_drv;
    +
    + return 0;
    +
    +err_unreg_iommu_drv:
    + platform_driver_unregister(&rk_iommu_driver);
    +err_unreg_domain_drv:
    + platform_driver_unregister(&rk_iommu_domain_driver);
    +
    return ret;
    }
    static void __exit rk_iommu_exit(void)
    --
    2.11.0

    \
     
     \ /
      Last update: 2018-01-14 23:22    [W:4.182 / U:0.844 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site