diff mbox

[U-Boot,1/4] mtdparts: fix usecount bug

Message ID 1405322231-30713-1-git-send-email-hs@denx.de
State Accepted
Delegated to: Anatolij Gustschin
Headers show

Commit Message

Heiko Schocher July 14, 2014, 7:17 a.m. UTC
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>

---
found this bug with the linux v3.14 mtd/ubi/ubifs sync, but this
is also wrong in current mainline.

 common/cmd_mtdparts.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
index 40b6333..3cb0571 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;
 }