summaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/partition.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index 2a0d5bb563..e66b6ccc16 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -131,7 +131,7 @@ static int of_partition_fixup(struct device_node *root, void *ctx)
struct cdev *cdev = ctx, *partcdev;
struct device_node *np, *part, *partnode;
int ret;
- int n_cells;
+ int n_cells, n_parts = 0;
if (of_partition_binding == MTD_OF_BINDING_DONTTOUCH)
return 0;
@@ -139,6 +139,13 @@ static int of_partition_fixup(struct device_node *root, void *ctx)
if (!cdev->device_node)
return -EINVAL;
+ list_for_each_entry(partcdev, &cdev->partitions, partition_entry) {
+ n_parts++;
+ }
+
+ if (!n_parts)
+ return 0;
+
if (cdev->size >= 0x100000000)
n_cells = 2;
else