Prepare of_overlay_global_fixup() for upcoming FIT image based overlays
support.

Check if the of_overlay_path is empty and return early. Make use of
isempty() helper while on it.

Simplify the code flow by setting up the dir variable accordingly before
calling of_overlay_apply_dir() to drop special '/' path
of_overlay_apply_dir() call.

Signed-off-by: Marco Felsch <m.fel...@pengutronix.de>
---
 drivers/of/overlay.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 
bc3fdff0cd277b3460981769c2b220adfced6e80..f02a12d44f0d53db3fb7bb065461c0ef193d0ab3
 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -468,13 +468,13 @@ static int of_overlay_global_fixup(struct device_node 
*root, void *data)
        char *dir;
        int ret;
 
-       if (*of_overlay_path == '/')
-               return of_overlay_apply_dir(root, of_overlay_path, true);
-
-       if (*of_overlay_path == '\0')
+       if (isempty(of_overlay_path))
                return 0;
 
-       dir = concat_path_file(of_overlay_basedir, of_overlay_path);
+       if (*of_overlay_path == '/')
+               dir = xstrdup(of_overlay_path);
+       else
+               dir = concat_path_file(of_overlay_basedir, of_overlay_path);
 
        ret = of_overlay_apply_dir(root, dir, true);
 

-- 
2.39.5


Reply via email to