summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2015-06-01 23:10:52 +0200
committerBrian Norris <computersforpeace@gmail.com>2015-06-17 03:58:47 +0200
commit45c2ebd702a468d5037cf16aa4f8ea8d67776f6a (patch)
treeebac3d3ad0bd4d79dd3897803b272e8c11252040 /drivers/mtd
parentmtd: nandsim: Fix kasprintf() usage (diff)
downloadlinux-45c2ebd702a468d5037cf16aa4f8ea8d67776f6a.tar.xz
linux-45c2ebd702a468d5037cf16aa4f8ea8d67776f6a.zip
mtd: docg3: Don't leak docg3->bbt in error path
Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/devices/docg3.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index be5fb2bd893c..486936bf41d5 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -1900,7 +1900,7 @@ doc_probe_device(struct docg3_cascade *cascade, int floor, struct device *dev)
ret = 0;
if (chip_id != (u16)(~chip_id_inv)) {
- goto nomem3;
+ goto nomem4;
}
switch (chip_id) {
@@ -1910,7 +1910,7 @@ doc_probe_device(struct docg3_cascade *cascade, int floor, struct device *dev)
break;
default:
doc_err("Chip id %04x is not a DiskOnChip G3 chip\n", chip_id);
- goto nomem3;
+ goto nomem4;
}
doc_set_driver_info(chip_id, mtd);
@@ -1919,6 +1919,8 @@ doc_probe_device(struct docg3_cascade *cascade, int floor, struct device *dev)
doc_reload_bbt(docg3);
return mtd;
+nomem4:
+ kfree(docg3->bbt);
nomem3:
kfree(mtd);
nomem2: