[PATCH 04/11] ARM: i.MX: bbu: Convert devicefile to device name

Andrey Smirnov andrew.smirnov at gmail.com
Tue Sep 18 15:22:58 PDT 2018


Data->devicefile can contain absolute path to target device, so we
need to convert it to a device name before we can safely use it.

Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
---
 arch/arm/mach-imx/imx-bbu-internal.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index faa266572..14bc569b7 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -409,8 +409,9 @@ static int imx_bbu_internal_mmcboot_update(struct bbu_handler *handler,
 	char *bootpartvar;
 	const char *bootpart;
 	char *devicefile;
+	const char *devname = devpath_to_name(data->devicefile);
 
-	ret = asprintf(&bootpartvar, "%s.boot", data->devicefile);
+	ret = asprintf(&bootpartvar, "%s.boot", devname);
 	if (ret < 0)
 		return ret;
 
@@ -427,7 +428,7 @@ static int imx_bbu_internal_mmcboot_update(struct bbu_handler *handler,
 		bootpart = "boot0";
 	}
 
-	ret = asprintf(&devicefile, "/dev/%s.%s", data->devicefile, bootpart);
+	ret = asprintf(&devicefile, "/dev/%s.%s", devname, bootpart);
 	if (ret < 0)
 		goto free_bootpartvar;
 
-- 
2.17.1




More information about the barebox mailing list