diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2015-01-15 18:32:35 -0800 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-01-16 08:11:42 +0100 |
commit | 3d3cf5e58e55a75f56cdf8804a9ffed13e9ac84d (patch) | |
tree | f173f88356b7bc5023a5e638a8e1a7f19dea47ea /arch | |
parent | c39993fcdbbc1b3b59da6eaf12d7c09c2d70123e (diff) | |
download | barebox-3d3cf5e58e55a75f56cdf8804a9ffed13e9ac84d.tar.gz barebox-3d3cf5e58e55a75f56cdf8804a9ffed13e9ac84d.tar.xz |
i.MX6: phytec: Check environment path selection for errors
Add code to explicitly check for success of of_device_enable_path()
when selecting which media is expected to contain barebox environment.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/boards/phytec-phyflex-imx6/board.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/arm/boards/phytec-phyflex-imx6/board.c b/arch/arm/boards/phytec-phyflex-imx6/board.c index 7ac79283a9..c731faf6f1 100644 --- a/arch/arm/boards/phytec-phyflex-imx6/board.c +++ b/arch/arm/boards/phytec-phyflex-imx6/board.c @@ -65,6 +65,9 @@ static void phyflex_err006282_workaround(void) static int phytec_pfla02_init(void) { + int ret; + char *environment_path; + if (!of_machine_is_compatible("phytec,imx6q-pfla02") && !of_machine_is_compatible("phytec,imx6dl-pfla02") && !of_machine_is_compatible("phytec,imx6s-pfla02")) @@ -76,17 +79,22 @@ static int phytec_pfla02_init(void) switch (bootsource_get()) { case BOOTSOURCE_MMC: - of_device_enable_path("/chosen/environment-sd"); + environment_path = "/chosen/environment-sd"; break; case BOOTSOURCE_NAND: - of_device_enable_path("/chosen/environment-nand"); + environment_path = "/chosen/environment-nand"; break; default: case BOOTSOURCE_SPI: - of_device_enable_path("/chosen/environment-spinor"); + environment_path = "/chosen/environment-spinor"; break; } + ret = of_device_enable_path(environment_path); + if (ret < 0) + pr_warn("Failed to enable environment partition '%s' (%d)\n", + environment_path, ret); + return 0; } device_initcall(phytec_pfla02_init); |