]> git.baikalelectronics.ru Git - uboot.git/commitdiff
treewide: Use fdt_create_phandle() where appropriate
authorMarek Behún <marek.behun@nic.cz>
Fri, 26 Nov 2021 13:57:06 +0000 (14:57 +0100)
committerStefan Roese <sr@denx.de>
Sun, 19 Dec 2021 08:50:47 +0000 (09:50 +0100)
Replace fdt_alloc_phandle() with subsequent fdt_set_phandle() by
fdt_create_phandle().

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
board/Marvell/octeon_ebb7304/board.c
drivers/misc/fsl_portals.c

index e8e2d547c1ee029b7710066a72bd977c36840235..c6c7c13483f44ab69b86e74b67b503b5ab755dd8 100644 (file)
@@ -205,7 +205,7 @@ static int fdt_fix_mix(const void *fdt)
                int env_lmac = -1;
                int lmac_fdt_node = -1;
                int mix_fdt_node = -1;
-               int lmac_phandle;
+               unsigned int lmac_phandle;
                char *compat;
 
                /* Get the lmac for this environment variable */
@@ -229,8 +229,7 @@ static int fdt_fix_mix(const void *fdt)
                        }
                }
 
-               lmac_phandle = fdt_alloc_phandle((void *)fdt);
-               fdt_set_phandle((void *)fdt, lmac_fdt_node, lmac_phandle);
+               lmac_phandle = fdt_create_phandle((void *)fdt, lmac_fdt_node);
 
                /* Get the fdt mix node corresponding to this lmac */
                mix_fdt_node = get_mix_fdt_node(fdt, env_node, env_lmac);
index 632430e42099518232f720c25b59e1c7ba0f75dd..02bc3f86cae054e0c066220399b5c0ff2b9e9376 100644 (file)
@@ -106,7 +106,7 @@ static int fdt_qportal(void *blob, int off, int id, char *name,
                       enum fsl_dpaa_dev dev, int create)
 {
        int childoff, dev_off, ret = 0;
-       u32 dev_handle;
+       unsigned int dev_handle;
 #ifdef CONFIG_FSL_CORENET
        int num;
        u32 liodns[2];
@@ -142,11 +142,9 @@ static int fdt_qportal(void *blob, int off, int id, char *name,
                if (childoff > 0) {
                        dev_handle = fdt_get_phandle(blob, dev_off);
                        if (dev_handle <= 0) {
-                               dev_handle = fdt_alloc_phandle(blob);
-                               ret = fdt_set_phandle(blob, dev_off,
-                                                     dev_handle);
-                               if (ret < 0)
-                                       return ret;
+                               dev_handle = fdt_create_phandle(blob, dev_off);
+                               if (!dev_handle)
+                                       return -FDT_ERR_NOPHANDLES;
                        }
 
                        ret = fdt_setprop(blob, childoff, "dev-handle",