linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] plat_ram: call mtd_device_register only if partition data exists
@ 2011-12-12 23:37 Ilya Yanok
  2011-12-17 15:31 ` Artem Bityutskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Ilya Yanok @ 2011-12-12 23:37 UTC (permalink / raw)
  To: linux-mtd; +Cc: Ilya Yanok

mtd_device_parse_register() registers the device as a whole if no
partition data is passed so there is no reason to call
mtd_device_register() after that.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
---
 drivers/mtd/maps/plat-ram.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c
index 94f5534..45876d0 100644
--- a/drivers/mtd/maps/plat-ram.c
+++ b/drivers/mtd/maps/plat-ram.c
@@ -227,10 +227,14 @@ static int platram_probe(struct platform_device *pdev)
 	if (!err)
 		dev_info(&pdev->dev, "registered mtd device\n");
 
-	/* add the whole device. */
-	err = mtd_device_register(info->mtd, NULL, 0);
-	if (err)
-		dev_err(&pdev->dev, "failed to register the entire device\n");
+	if (pdata->nr_partitions) {
+		/* add the whole device. */
+		err = mtd_device_register(info->mtd, NULL, 0);
+		if (err) {
+			dev_err(&pdev->dev,
+				"failed to register the entire device\n");
+		}
+	}
 
 	return err;
 
-- 
1.7.6.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-18 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12 23:37 [PATCH] plat_ram: call mtd_device_register only if partition data exists Ilya Yanok
2011-12-17 15:31 ` Artem Bityutskiy
2011-12-17 22:26   ` Ilya Yanok
2011-12-18 11:49     ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).