diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-11-10 08:58:16 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-11-10 09:03:06 +0100 |
commit | 99c9da2817ba1bcc3d33782e68ec6ceeeb2c4545 (patch) | |
tree | d18c43faea0755c89c9f829e8c3c0ae1d2a52770 | |
parent | d9c2cfd534d2ebda662f2656b2e8076b255b4987 (diff) | |
download | barebox-99c9da2817ba1bcc3d33782e68ec6ceeeb2c4545.tar.gz |
ARM: omap: Use correct device to mount on /boot
The current code tests if a partition (i.e. disk0.0) exists and instead
of mounting boot from this partition it uses the whole device (disk0).
This only works because the the FAT code accepts a MBR as input and
automatically skips it.
Let the code use the partition to mount /boot instead as it was
intended. We don't have to stat() the partition device, since this
error will be caught by mount() anyway, so remove the unnecessary
stat().
Reported-by: Peter Mamonov <pmamonov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/mach-omap/omap_generic.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/arch/arm/mach-omap/omap_generic.c b/arch/arm/mach-omap/omap_generic.c index 071a1bfced..4e26c6ba0b 100644 --- a/arch/arm/mach-omap/omap_generic.c +++ b/arch/arm/mach-omap/omap_generic.c @@ -111,7 +111,6 @@ const char *omap_get_bootmmc_devname(void) #define ENV_PATH "/boot/barebox.env" static int omap_env_init(void) { - struct stat s; char *partname; const char *diskdev; int ret; @@ -128,25 +127,19 @@ static int omap_env_init(void) partname = asprintf("/dev/%s.0", diskdev); - ret = stat(partname, &s); - - free(partname); - - if (ret) { - pr_err("Failed to load environment: no device '%s'\n", diskdev); - return 0; - } - mkdir("/boot", 0666); - ret = mount(diskdev, "fat", "/boot", NULL); + ret = mount(partname, "fat", "/boot", NULL); if (ret) { - pr_err("Failed to load environment: mount %s failed (%d)\n", diskdev, ret); - return 0; + pr_err("Failed to load environment: mount %s failed (%d)\n", partname, ret); + goto out; } - pr_debug("Loading default env from %s on device %s\n", ENV_PATH, diskdev); + pr_debug("Loading default env from %s on device %s\n", ENV_PATH, partname); default_environment_path_set(ENV_PATH); +out: + free(partname); + return 0; } late_initcall(omap_env_init); |