From: Ilya Yanok <yanok@emcraft.com>
To: linux-mtd@lists.infradead.org
Cc: Ilya Yanok <yanok@emcraft.com>
Subject: [PATCH] plat_ram: call mtd_device_register only if partition data exists
Date: Tue, 13 Dec 2011 00:37:56 +0100 [thread overview]
Message-ID: <1323733076-6301-1-git-send-email-yanok@emcraft.com> (raw)
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
next reply other threads:[~2011-12-12 23:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-12 23:37 Ilya Yanok [this message]
2011-12-17 15:31 ` [PATCH] plat_ram: call mtd_device_register only if partition data exists Artem Bityutskiy
2011-12-17 22:26 ` Ilya Yanok
2011-12-18 11:49 ` Artem Bityutskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1323733076-6301-1-git-send-email-yanok@emcraft.com \
--to=yanok@emcraft.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).