From patchwork Tue Aug 6 16:41:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 265173 X-Patchwork-Delegate: panto@antoniou-consulting.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 162CA2C40B8 for ; Wed, 7 Aug 2013 02:42:48 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A55DA4A01B; Tue, 6 Aug 2013 18:42:46 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NovLnXylmJXP; Tue, 6 Aug 2013 18:42:46 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AA9A14A01C; Tue, 6 Aug 2013 18:42:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 62DB94A01C for ; Tue, 6 Aug 2013 18:42:36 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n4GQcMJlHv1q for ; Tue, 6 Aug 2013 18:42:30 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by theia.denx.de (Postfix) with ESMTPS id C5B274A01B for ; Tue, 6 Aug 2013 18:42:22 +0200 (CEST) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r76GgHRs001727 for ; Tue, 6 Aug 2013 11:42:17 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r76GgHPs001499 for ; Tue, 6 Aug 2013 11:42:17 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Tue, 6 Aug 2013 11:42:16 -0500 Received: from uglx0153363.ucm2.emeaucm.ext.ti.com (uglx0153363.ucm2.emeaucm.ext.ti.com [10.167.145.181]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r76GgF7Q005977; Tue, 6 Aug 2013 11:42:16 -0500 From: Taras Kondratiuk To: Date: Tue, 6 Aug 2013 19:41:57 +0300 Message-ID: <1375807317-29972-1-git-send-email-taras@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Subject: [U-Boot] [PATCH] mmc: Initialize mmc_devices list statically X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 --- 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)