[PATCH 4/4] mtd: create the mtd master device for given set of partitions

Roman Tereshonkov roman.tereshonkov at nokia.com
Fri Jun 18 06:08:31 EDT 2010


The master device is needed for repartioning to be done.

Signed-off-by: Roman Tereshonkov <roman.tereshonkov at nokia.com>
---
 drivers/mtd/onenand/omap2.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index 9f322f1..f9bdad8 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -724,12 +724,14 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
 	}
 
 #ifdef CONFIG_MTD_PARTITIONS
-	if (pdata->parts != NULL)
+	if (pdata->parts != NULL) {
 		r = add_mtd_partitions(&c->mtd, pdata->parts,
 				       pdata->nr_parts);
-	else
+		if (r < 0)
+			goto err_release_onenand;
+	}
 #endif
-		r = add_mtd_device(&c->mtd);
+	r = add_mtd_device(&c->mtd);
 	if (r < 0)
 		goto err_release_onenand;
 
-- 
1.6.2.4




More information about the linux-mtd mailing list