imx8: cpu: check resource owned after sid fail
authorPeng Fan <peng.fan@nxp.com>
Tue, 5 May 2020 12:28:46 +0000 (20:28 +0800)
committerStefano Babic <sbabic@denx.de>
Sun, 10 May 2020 18:55:21 +0000 (20:55 +0200)
When we create software partition, we still need let parent
partition to configure sid, so move the check after sid failed.

Acked-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
arch/arm/mach-imx/imx8/fdt.c

index 599364537862468338af55eb43d86308638354b3..9a6822a929184c693f09e552bab55dc26dc5bf0b 100644 (file)
@@ -106,13 +106,13 @@ static int config_smmu_resource_sid(int rsrc, int sid)
 {
        int err;
 
-       if (!check_owned_resource(rsrc)) {
-               printf("%s rsrc[%d] not owned\n", __func__, rsrc);
-               return -1;
-       }
        err = sc_rm_set_master_sid(-1, rsrc, sid);
        debug("set_master_sid rsrc=%d sid=0x%x err=%d\n", rsrc, sid, err);
        if (err != SC_ERR_NONE) {
+               if (!check_owned_resource(rsrc)) {
+                       printf("%s rsrc[%d] not owned\n", __func__, rsrc);
+                       return -1;
+               }
                pr_err("fail set_master_sid rsrc=%d sid=0x%x err=%d\n", rsrc, sid, err);
                return -EINVAL;
        }