diff mbox

[U-Boot] mmc: Initialize mmc_devices list statically

Message ID 1375807317-29972-1-git-send-email-taras@ti.com
State Rejected
Delegated to: Pantelis Antoniou
Headers show

Commit Message

Taras Kondratiuk Aug. 6, 2013, 4:41 p.m. UTC
Currently mmc_device list is initialized from mmc_initialize() function.
So crash happens if any function which use mmc_devices list (find_mmc_device,
print_mmc_devices, etc.) is called before mmc_initialize().

Fix this by initializing mmc_devices list statically.

Signed-off-by: Taras Kondratiuk <taras@ti.com>
---
 drivers/mmc/mmc.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Pantelis Antoniou Sept. 6, 2013, 11:43 a.m. UTC | #1
Hi Taras,

What are you doing that makes you call any of the mmc_devices list functions
before calling mmc_initialize()

Which board has this problem; this looks like a board problem to me.

Regards

-- Pantelis
  
On Aug 6, 2013, at 7:41 PM, Taras Kondratiuk wrote:

> Currently mmc_device list is initialized from mmc_initialize() function.
> So crash happens if any function which use mmc_devices list (find_mmc_device,
> print_mmc_devices, etc.) is called before mmc_initialize().
> 
> Fix this by initializing mmc_devices list statically.
> 
> Signed-off-by: Taras Kondratiuk <taras@ti.com>
> ---
> drivers/mmc/mmc.c |    3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 4da8db9..eb35582 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -21,7 +21,7 @@
> #define CONFIG_SYS_MMC_MAX_BLK_COUNT 65535
> #endif
> 
> -static struct list_head mmc_devices;
> +LIST_HEAD(mmc_devices);
> static int cur_dev_num = -1;
> 
> int __weak board_mmc_getwp(struct mmc *mmc)
> @@ -1477,7 +1477,6 @@ static void do_preinit(void)
> 
> int mmc_initialize(bd_t *bis)
> {
> -	INIT_LIST_HEAD (&mmc_devices);
> 	cur_dev_num = 0;
> 
> 	if (board_mmc_init(bis) < 0)
> -- 
> 1.7.9.5
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
diff mbox

Patch

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 4da8db9..eb35582 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -21,7 +21,7 @@ 
 #define CONFIG_SYS_MMC_MAX_BLK_COUNT 65535
 #endif
 
-static struct list_head mmc_devices;
+LIST_HEAD(mmc_devices);
 static int cur_dev_num = -1;
 
 int __weak board_mmc_getwp(struct mmc *mmc)
@@ -1477,7 +1477,6 @@  static void do_preinit(void)
 
 int mmc_initialize(bd_t *bis)
 {
-	INIT_LIST_HEAD (&mmc_devices);
 	cur_dev_num = 0;
 
 	if (board_mmc_init(bis) < 0)