From patchwork Mon May 26 20:31:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darwin Rambo X-Patchwork-Id: 30940 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 86D7520491 for ; Mon, 26 May 2014 20:31:52 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id hq11sf15967675vcb.6 for ; Mon, 26 May 2014 13:31:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id :mime-version:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=zs1NsKK/p1UBp67rH0EQmNq7i2AJ8lLq66zmlUznewg=; b=LrcTZTK68YV2tD5jL3jUvMgTB0WunciRUBkHgozDSqq85kJxBwlJGN39KOOlY/bjZm 1CR1ktD1Q3FNb/G2gxJwm3jQoxTXoQdAD2nvfApAO1JX55s07/6J42BLL8K7kSv5XcGX IPest5W1MW89LpfmUCTnmcBMS+b1igBbfzTJlZzKafUFcLj20rMzeUdoiedLfXXqWccR ZUv5l/aQcKIRmSlqaJ39RndC0lAPxfRL2fm4OS9wbHd+Gzz79CEmtO4jvlueMlnAebLc e+Y2mcRz+c5DNBOLq4RCBosBgPkP/ezCgs2YVTi4J/yhlZponmWZbBKmj4N+kDc9ORWo uDGw== X-Gm-Message-State: ALoCoQnGVHhMuQ56W6yy1xa6GH0Qg7jwQQsUqp0Nqe/XsaOKfEd+KEAN3Ibv2n6uI4LVJynDbsNH X-Received: by 10.58.143.66 with SMTP id sc2mr11287728veb.14.1401136311882; Mon, 26 May 2014 13:31:51 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.25.171 with SMTP id 40ls2908519qgt.85.gmail; Mon, 26 May 2014 13:31:51 -0700 (PDT) X-Received: by 10.58.126.4 with SMTP id mu4mr23626910veb.0.1401136311757; Mon, 26 May 2014 13:31:51 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id om8si6881250vcb.90.2014.05.26.13.31.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 May 2014 13:31:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id id10so6227393vcb.20 for ; Mon, 26 May 2014 13:31:51 -0700 (PDT) X-Received: by 10.220.44.141 with SMTP id a13mr49491vcf.71.1401136311652; Mon, 26 May 2014 13:31:51 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp68141vcb; Mon, 26 May 2014 13:31:51 -0700 (PDT) X-Received: by 10.180.74.108 with SMTP id s12mr30834089wiv.61.1401136310747; Mon, 26 May 2014 13:31:50 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id g4si20402311wje.83.2014.05.26.13.31.50 for ; Mon, 26 May 2014 13:31:50 -0700 (PDT) Received-SPF: none (google.com: u-boot-bounces@lists.denx.de does not designate permitted sender hosts) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 408584B638; Mon, 26 May 2014 22:31:49 +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 rUO8nP51m5ko; Mon, 26 May 2014 22:31:49 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 542E94B62A; Mon, 26 May 2014 22:31:47 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 63B6C4B62A for ; Mon, 26 May 2014 22:31:45 +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 wlfa0rKaWSwl for ; Mon, 26 May 2014 22:31:42 +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 mail-gw3-out.broadcom.com (mail-gw3-out.broadcom.com [216.31.210.64]) by theia.denx.de (Postfix) with ESMTP id 978EE4B625 for ; Mon, 26 May 2014 22:31:37 +0200 (CEST) X-IronPort-AV: E=Sophos;i="4.98,914,1392192000"; d="scan'208";a="31086992" Received: from irvexchcas07.broadcom.com (HELO IRVEXCHCAS07.corp.ad.broadcom.com) ([10.9.208.55]) by mail-gw3-out.broadcom.com with ESMTP; 26 May 2014 13:33:10 -0700 Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS07.corp.ad.broadcom.com (10.9.208.55) with Microsoft SMTP Server (TLS) id 14.3.174.1; Mon, 26 May 2014 13:31:35 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.3.174.1; Mon, 26 May 2014 13:31:35 -0700 Received: from mail.broadcom.com (dhcp-rmna-vpn-104.ric.broadcom.com [10.136.253.104]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id F31FB9F9F7; Mon, 26 May 2014 13:31:34 -0700 (PDT) From: Darwin Rambo To: Tom Rini Date: Mon, 26 May 2014 13:31:12 -0700 Message-ID: <1401136272-8611-1-git-send-email-drambo@broadcom.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Cc: u-boot@lists.denx.de, Darwin Rambo , Pantelis Antoniou Subject: [U-Boot] [PATCH] mmc: free allocated memory on initialization errors X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: 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 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: drambo@broadcom.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Cleanup to balance malloc/free calls. Signed-off-by: Darwin Rambo Reviewed-by: Steve Rae Acked-by: Pantelis Antoniou --- drivers/mmc/kona_sdhci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/kona_sdhci.c b/drivers/mmc/kona_sdhci.c index 77e42c8..f804f4c 100644 --- a/drivers/mmc/kona_sdhci.c +++ b/drivers/mmc/kona_sdhci.c @@ -113,16 +113,20 @@ int kona_sdhci_init(int dev_index, u32 min_clk, u32 quirks) __func__, dev_index); ret = -EINVAL; } - if (ret) + if (ret) { + free(host); return ret; + } host->name = "kona-sdhci"; host->ioaddr = reg_base; host->quirks = quirks; host->host_caps = MMC_MODE_HC; - if (init_kona_mmc_core(host)) + if (init_kona_mmc_core(host)) { + free(host); return -EINVAL; + } if (quirks & SDHCI_QUIRK_REG32_RW) host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;