From patchwork Wed Nov 29 14:29:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 842591 X-Patchwork-Delegate: jh80.chung@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="WXDeOAFJ"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yn3113MDPz9sBZ for ; Thu, 30 Nov 2017 01:33:09 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 23D77C21F38; Wed, 29 Nov 2017 14:31:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B53F6C21F70; Wed, 29 Nov 2017 14:30:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BA732C21F2F; Wed, 29 Nov 2017 14:30:17 +0000 (UTC) Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by lists.denx.de (Postfix) with ESMTPS id 6379CC21F6C for ; Wed, 29 Nov 2017 14:30:12 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id vATEU9xB017182; Wed, 29 Nov 2017 08:30:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1511965809; bh=Iut+ik3/hjmCl1GRiLp4XIZsoc0a4DZVwHWJg0HqSyQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=WXDeOAFJBTRd3HNIL3+el/iD6niENpya+AJRkmW/ignkgToHML/kS4LP/Aub65N1S 9kDgF8mCeifsmJ/ikC7BF6JPe15TQLxL2x2dVMtnwrN+mW+bq0SB5C3I+j9htYAoRO zrfTmfKC32qrpig2vXIDYPl1/oJPYk7cqUgpZKCQ= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id vATEU9xA010268; Wed, 29 Nov 2017 08:30:09 -0600 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Wed, 29 Nov 2017 08:30:08 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Wed, 29 Nov 2017 08:30:09 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id vATEU8Ab012942; Wed, 29 Nov 2017 08:30:08 -0600 From: Jean-Jacques Hiblot To: , , , , , Date: Wed, 29 Nov 2017 15:29:50 +0100 Message-ID: <1511965794-24118-6-git-send-email-jjhiblot@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511965794-24118-1-git-send-email-jjhiblot@ti.com> References: <1511965794-24118-1-git-send-email-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Subject: [U-Boot] [PATCH v4 05/10] mmc: fix for old MMCs (below version 4) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The ext_csd is allocated only for MMC above version 4. The compare will crash or fail for older MMCs. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass --- drivers/mmc/mmc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 0ebcc45..2a58031 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1657,6 +1657,9 @@ static int mmc_read_and_compare_ext_csd(struct mmc *mmc) const u8 *ext_csd = mmc->ext_csd; ALLOC_CACHE_ALIGN_BUFFER(u8, test_csd, MMC_MAX_BLOCK_LEN); + if (mmc->version < MMC_VERSION_4) + return 0; + err = mmc_send_ext_csd(mmc, test_csd); if (err) return err;