diff --git a/drivers/of/partition.c b/drivers/of/partition.c index 5ed44a8..c3a404c 100644 --- a/drivers/of/partition.c +++ b/drivers/of/partition.c @@ -21,6 +21,7 @@ #include #include #include +#include #include struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node) @@ -60,10 +61,14 @@ filename = asprintf("%s.%s", cdev->name, partname); new = devfs_add_partition(cdev->name, offset, size, flags, filename); + if (IS_ERR(new)) { + new = NULL; + goto out; + } if (cdev->mtd && cdev->mtd->type == MTD_NANDFLASH) dev_add_bb_dev(filename, NULL); - +out: free(filename); return new;