Instead of opencoding this at multiple places, use the helper we have
for it.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 commands/findmnt.c        | 2 +-
 common/bootscan.c         | 2 +-
 common/imx-bbu-nand-fcb.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/commands/findmnt.c b/commands/findmnt.c
index a531b1a95a83..b1c323ebbff2 100644
--- a/commands/findmnt.c
+++ b/commands/findmnt.c
@@ -92,7 +92,7 @@ static int do_findmnt(int argc, char *argv[])
                                continue;
 
                        backingstore = target->backingstore;
-                       backingstore += str_has_prefix(backingstore, "/dev/");
+                       backingstore = devpath_to_name(backingstore);
 
                        if (streq_ptr(backingstore, cdev->name)) {
                                print_header(&header_printed);
diff --git a/common/bootscan.c b/common/bootscan.c
index 813d6d242a08..faaceaa22152 100644
--- a/common/bootscan.c
+++ b/common/bootscan.c
@@ -145,7 +145,7 @@ static int boot_scan_devicename(struct bootscanner *scanner,
        pr_debug("%s(%s): %s\n", __func__, scanner->name, devname);
 
        /* Support both boot /dev/disk0.rootfs and boot disk0.rootfs */
-       devname += str_has_prefix(devname, "/dev/");
+       devname = devpath_to_name(devname);
 
        device_detect_by_name(devname);
 
diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index 7593cd27fec9..0ca5782a702e 100644
--- a/common/imx-bbu-nand-fcb.c
+++ b/common/imx-bbu-nand-fcb.c
@@ -1232,7 +1232,7 @@ static int imx_bbu_nand_update(struct bbu_handler 
*handler, struct bbu_data *dat
        }
 
        /* Support both boot /dev/nand0.barebox and boot nand0.barebox */
-       devname += str_has_prefix(devname, "/dev/");
+       devname = devpath_to_name(devname);
 
        device_detect_by_name(devname);
 
-- 
2.47.3


Reply via email to