summaryrefslogtreecommitdiffstats
path: root/drivers/of/partition.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/of/partition.c')
-rw-r--r--drivers/of/partition.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index e2ddec564e..3dce84404f 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -21,6 +21,7 @@
#include <of.h>
#include <malloc.h>
#include <linux/mtd/mtd.h>
+#include <linux/err.h>
#include <nand.h>
struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node)
@@ -60,6 +61,9 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node)
filename = asprintf("%s.%s", cdev->name, partname);
new = devfs_add_partition(cdev->name, offset, size, flags, filename);
+ if (IS_ERR(new))
+ new = NULL;
+
if (new && new->dev)
new->dev->device_node = node;