From: Heiko Schocher <hs@denx.de>
Date: Mon, 14 Jul 2014 07:17:11 +0000 (+0200)
Subject: mtdparts: fix usecount bug
X-Git-Tag: v2025.01-rc5-pxa1908~14798^2~2
X-Git-Url: http://git.dujemihanovic.xyz/html/%7B%7B%20.RelPermalink%20%7D%7D?a=commitdiff_plain;h=1668d64439ecf4af64d5de2e24bb3d7c4e643b25;p=u-boot.git

mtdparts: fix usecount bug

add missing put_mtd_device, so mtd->usecount gets correct
decremented in get_mtd_info().

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Tom Rini <trini@ti.com>
---

diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
index 40b6333ebf..3cb0571df3 100644
--- a/common/cmd_mtdparts.c
+++ b/common/cmd_mtdparts.c
@@ -292,6 +292,7 @@ static int get_mtd_info(u8 type, u8 num, struct mtd_info **mtd)
 		printf("Device %s not found!\n", mtd_dev);
 		return 1;
 	}
+	put_mtd_device(*mtd);
 
 	return 0;
 }