提交 1b26bab1 编写于 作者: D Daniel Kochmański 提交者: Hans de Goede

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: NDaniel Kochmański <dkochmanski@turtle-solutions.eu>
CC: Roy Spliet <r.spliet@ultimaker.com>
Cc: Ian Campbell <ijc@hellion.org.uk>
CC: Pantelis Antoniou <panto@antoniou-consulting.com>
Acked-by: NHans de Goede <hdegoede@redhat.com>
Signed-off-by: NHans de Goede <hdegoede@redhat.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册