diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 4eea97c03b2bfe308972f6c4b9e4e6fd9f79918c..16120e2dd4a3d6229a2e4a3de6cea991436f8201 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1054,7 +1054,8 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)
 static int omap_nand_remove(struct platform_device *pdev)
 {
 	struct mtd_info *mtd = platform_get_drvdata(pdev);
-	struct omap_nand_info *info = mtd->priv;
+	struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
+							mtd);
 
 	platform_set_drvdata(pdev, NULL);
 	if (use_dma)