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>
This commit is contained in:
Richard Weinberger 2015-06-01 23:10:52 +02:00 committed by Brian Norris
parent 641c7925b6
commit 45c2ebd702
1 changed files with 4 additions and 2 deletions

View File

@ -1900,7 +1900,7 @@ doc_probe_device(struct docg3_cascade *cascade, int floor, struct device *dev)
ret = 0; ret = 0;
if (chip_id != (u16)(~chip_id_inv)) { if (chip_id != (u16)(~chip_id_inv)) {
goto nomem3; goto nomem4;
} }
switch (chip_id) { switch (chip_id) {
@ -1910,7 +1910,7 @@ doc_probe_device(struct docg3_cascade *cascade, int floor, struct device *dev)
break; break;
default: default:
doc_err("Chip id %04x is not a DiskOnChip G3 chip\n", chip_id); 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); 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); doc_reload_bbt(docg3);
return mtd; return mtd;
nomem4:
kfree(docg3->bbt);
nomem3: nomem3:
kfree(mtd); kfree(mtd);
nomem2: nomem2: