summaryrefslogtreecommitdiff
path: root/drivers/mtd/mtdblock_ro.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/mtdblock_ro.c')
-rw-r--r--drivers/mtd/mtdblock_ro.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mtd/mtdblock_ro.c b/drivers/mtd/mtdblock_ro.c
index 54ff2880cf65..d0d3f79f9d03 100644
--- a/drivers/mtd/mtdblock_ro.c
+++ b/drivers/mtd/mtdblock_ro.c
@@ -43,7 +43,8 @@ static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
dev->tr = tr;
dev->readonly = 1;
- add_mtd_blktrans_dev(dev);
+ if (add_mtd_blktrans_dev(dev))
+ kfree(dev);
}
static void mtdblock_remove_dev(struct mtd_blktrans_dev *dev)