All of lore.kernel.org
 help / color / mirror / Atom feed
From: sunil.m at techveda.org <sunil.m@techveda.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] drivers: mmc: Avoid memory leak in case of failure
Date: Mon, 19 Jun 2017 22:23:43 +0530	[thread overview]
Message-ID: <1497891223-32073-1-git-send-email-sunil.m@techveda.org> (raw)

From: Suniel Mahesh <sunil.m@techveda.org>

priv pointer should be freed before returning with an error value
from exynos_dwmci_get_config().

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
Signed-off-by: Raghu Bharadwaj <raghu@techveda.org>
---
 drivers/mmc/exynos_dw_mmc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
index 40f7892..84ef2da 100644
--- a/drivers/mmc/exynos_dw_mmc.c
+++ b/drivers/mmc/exynos_dw_mmc.c
@@ -168,6 +168,7 @@ static int exynos_dwmci_get_config(const void *blob, int node,
 
 	if (host->dev_index > 4) {
 		printf("DWMMC%d: Can't get the dev index\n", host->dev_index);
+		free(priv);
 		return -EINVAL;
 	}
 
@@ -178,6 +179,7 @@ static int exynos_dwmci_get_config(const void *blob, int node,
 	base = fdtdec_get_addr(blob, node, "reg");
 	if (!base) {
 		printf("DWMMC%d: Can't get base address\n", host->dev_index);
+		free(priv);
 		return -EINVAL;
 	}
 	host->ioaddr = (void *)base;
@@ -187,6 +189,7 @@ static int exynos_dwmci_get_config(const void *blob, int node,
 	if (err) {
 		printf("DWMMC%d: Can't get sdr-timings for devider\n",
 				host->dev_index);
+		free(priv);
 		return -EINVAL;
 	}
 
-- 
1.9.1

             reply	other threads:[~2017-06-19 16:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170619165424epcas5p1a9f4deac326295f32d2d3e36861bfbbc@epcas5p1.samsung.com>
2017-06-19 16:53 ` sunil.m at techveda.org [this message]
2017-07-17 11:08   ` [U-Boot] [PATCH] drivers: mmc: Avoid memory leak in case of failure Jaehoon Chung
2017-08-04  9:34     ` Suniel Mahesh
2017-08-18  7:30       ` Jaehoon Chung
2017-09-25 10:47         ` Suniel Mahesh
2017-10-05  6:18         ` [U-Boot] [PATCH v2] " sunil.m at techveda.org
2017-10-20 11:45           ` Jaehoon Chung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1497891223-32073-1-git-send-email-sunil.m@techveda.org \
    --to=sunil.m@techveda.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.