9
0
Fork 0

mtd: core: avoid possible NULL ptr deref

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Lucas Stach 2014-02-07 09:48:54 +01:00 committed by Sascha Hauer
parent 8850df8cee
commit 40fa265fab
1 changed files with 2 additions and 1 deletions

View File

@ -404,7 +404,8 @@ 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)