diff options
| author | Stephen Warren <swarren@nvidia.com> | 2012-10-30 07:50:47 +0000 | 
|---|---|---|
| committer | Tom Rini <trini@ti.com> | 2012-11-02 15:13:29 -0700 | 
| commit | a1b231cef634d8aaa002bcb848332785803127c8 (patch) | |
| tree | 01d713ab80148fe83c0584622b76314ff3668602 | |
| parent | ed296d206a1840c0a0b6c1322379c950f9996905 (diff) | |
| download | olio-uboot-2014.01-a1b231cef634d8aaa002bcb848332785803127c8.tar.xz olio-uboot-2014.01-a1b231cef634d8aaa002bcb848332785803127c8.zip | |
fs: handle CONFIG_NEEDS_MANUAL_RELOC
Without this, fstypes[].probe points at the wrong place, so calling the
function results in undefined behaviour.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Andreas Bießmann <andreas.devel@googlemail.com>
| -rw-r--r-- | fs/fs.c | 13 | 
1 files changed, 12 insertions, 1 deletions
| @@ -21,6 +21,8 @@  #include <fat.h>  #include <fs.h> +DECLARE_GLOBAL_DATA_PTR; +  static block_dev_desc_t *fs_dev_desc;  static disk_partition_t fs_partition;  static int fs_type = FS_TYPE_ANY; @@ -141,7 +143,7 @@ static inline void fs_close_ext(void)  #define fs_read_ext fs_read_unsupported  #endif -static const struct { +static struct {  	int fstype;  	int (*probe)(void);  } fstypes[] = { @@ -158,6 +160,15 @@ static const struct {  int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)  {  	int part, i; +#ifdef CONFIG_NEEDS_MANUAL_RELOC +	static int relocated; + +	if (!relocated) { +		for (i = 0; i < ARRAY_SIZE(fstypes); i++) +			fstypes[i].probe += gd->reloc_off; +		relocated = 1; +	} +#endif  	part = get_device_and_partition(ifname, dev_part_str, &fs_dev_desc,  					&fs_partition, 1); |