9
0
Fork 0

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>
This commit is contained in:
Sascha Hauer 2014-01-14 10:27:10 +01:00
parent bfc58c2d8e
commit 6f0a7d82a1
1 changed files with 3 additions and 1 deletions

View File

@ -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)