Skip to content
Snippets Groups Projects
Commit 9def12ca authored by Stefan Roese's avatar Stefan Roese
Browse files

MTD: Fix problem based on non-working relocation (list head mtd_partitions)


Don't use LIST_HEAD() but initialize the struct via INIT_LIST_HEAD() upon
first call of add_mtd_partitions(). Otherwise this won't work on platforms
where the relocation is broken (like MIPS or PPC).

Signed-off-by: default avatarStefan Roese <sr@denx.de>
parent 13d36ec8
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <linux/mtd/compat.h> #include <linux/mtd/compat.h>
/* Our partition linked list */ /* Our partition linked list */
static LIST_HEAD(mtd_partitions); struct list_head mtd_partitions;
/* Our partition node structure */ /* Our partition node structure */
struct mtd_part { struct mtd_part {
...@@ -349,6 +349,14 @@ int add_mtd_partitions(struct mtd_info *master, ...@@ -349,6 +349,14 @@ int add_mtd_partitions(struct mtd_info *master,
u_int32_t cur_offset = 0; u_int32_t cur_offset = 0;
int i; int i;
/*
* Need to init the list here, since LIST_INIT() does not
* work on platforms where relocation has problems (like MIPS
* & PPC).
*/
if (mtd_partitions.next == NULL)
INIT_LIST_HEAD(&mtd_partitions);
printk (KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); printk (KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name);
for (i = 0; i < nbparts; i++) { for (i = 0; i < nbparts; i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment