Commit 1b26bab1 authored by Daniel Kochmański's avatar Daniel Kochmański Committed by Hans de Goede
Browse files

mmc: Protect `mmc_initialize` from initialising mmc multiple times

`mmc_initialize` might be called multiple times leading to the mmc-controllers
being initialised twice, and initialising the `mmc_devices` list head twice
which may lead to memory leaks.
Signed-off-by: default avatarDaniel Kochmański <>
CC: Roy Spliet <>
Cc: Ian Campbell <>
CC: Pantelis Antoniou <>
Acked-by: default avatarHans de Goede <>
Signed-off-by: default avatarHans de Goede <>
parent 413978d1
......@@ -1762,6 +1762,11 @@ static void do_preinit(void)
int mmc_initialize(bd_t *bis)
static int initialized = 0;
if (initialized) /* Avoid initializing mmc multiple times */
return 0;
initialized = 1;
INIT_LIST_HEAD (&mmc_devices);
cur_dev_num = 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment