diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-01-14 10:27:10 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-02-26 08:33:18 +0100 |
commit | 6f0a7d82a14ea868ed9f218f121798088376a8cf (patch) | |
tree | 01bac04a11d1a5c70e8c7917296d387a0fd68fe3 | |
parent | bfc58c2d8e330717c6f21967576c6af0d90e2369 (diff) | |
download | barebox-6f0a7d82a14ea868ed9f218f121798088376a8cf.tar.gz barebox-6f0a7d82a14ea868ed9f218f121798088376a8cf.tar.xz |
mtd: Only call of_parse_partitions when the mtd has a parent
mtd->parent is optional so we can't derefence mtd->parent->device_node
without checking mtd->parent.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/mtd/core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c index 534b4041e6..95044d57de 100644 --- a/drivers/mtd/core.c +++ b/drivers/mtd/core.c @@ -408,7 +408,9 @@ int add_mtd_device(struct mtd_info *mtd, char *devname, int device_id) } devfs_create(&mtd->cdev); - of_parse_partitions(&mtd->cdev, mtd->parent->device_node); + + if (mtd->parent) + of_parse_partitions(&mtd->cdev, mtd->parent->device_node); list_for_each_entry(hook, &mtd_register_hooks, hook) if (hook->add_mtd_device) |