[PATCH 05/11] ARM: i.MX: bbu: Detect MMC before reading current boot partition

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


In order to be able to read "mmcN.boot" we need to detect that device
first. Not doing so would result in failure if "barebox_update" is
executed before "detect mmc0".

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

diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index 14bc569b7..796d9454c 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -411,6 +411,12 @@ static int imx_bbu_internal_mmcboot_update(struct bbu_handler *handler,
 	char *devicefile;
 	const char *devname = devpath_to_name(data->devicefile);
 
+	ret = device_detect_by_name(devname);
+	if (ret) {
+		pr_err("Couldn't detect device '%s'\n", devname);
+		return ret;
+	}
+
 	ret = asprintf(&bootpartvar, "%s.boot", devname);
 	if (ret < 0)
 		return ret;
-- 
2.17.1




More information about the barebox mailing list