diff options
-rw-r--r-- | drivers/mtd/maps/physmap_of_core.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/drivers/mtd/maps/physmap_of_core.c b/drivers/mtd/maps/physmap_of_core.c index 14e8909c9955..62fa6836f218 100644 --- a/drivers/mtd/maps/physmap_of_core.c +++ b/drivers/mtd/maps/physmap_of_core.c | |||
@@ -116,32 +116,22 @@ static const char * const part_probe_types_def[] = { | |||
116 | 116 | ||
117 | static const char * const *of_get_probes(struct device_node *dp) | 117 | static const char * const *of_get_probes(struct device_node *dp) |
118 | { | 118 | { |
119 | const char *cp; | ||
120 | int cplen; | ||
121 | unsigned int l; | ||
122 | unsigned int count; | ||
123 | const char **res; | 119 | const char **res; |
120 | int count; | ||
124 | 121 | ||
125 | cp = of_get_property(dp, "linux,part-probe", &cplen); | 122 | count = of_property_count_strings(dp, "linux,part-probe"); |
126 | if (cp == NULL) | 123 | if (count < 0) |
127 | return part_probe_types_def; | 124 | return part_probe_types_def; |
128 | 125 | ||
129 | count = 0; | 126 | res = kzalloc((count + 1) * sizeof(*res), GFP_KERNEL); |
130 | for (l = 0; l != cplen; l++) | ||
131 | if (cp[l] == 0) | ||
132 | count++; | ||
133 | |||
134 | res = kzalloc((count + 1)*sizeof(*res), GFP_KERNEL); | ||
135 | if (!res) | 127 | if (!res) |
136 | return NULL; | 128 | return NULL; |
137 | count = 0; | 129 | |
138 | while (cplen > 0) { | 130 | count = of_property_read_string_array(dp, "linux,part-probe", res, |
139 | res[count] = cp; | 131 | count); |
140 | l = strlen(cp) + 1; | 132 | if (count < 0) |
141 | cp += l; | 133 | return NULL; |
142 | cplen -= l; | 134 | |
143 | count++; | ||
144 | } | ||
145 | return res; | 135 | return res; |
146 | } | 136 | } |
147 | 137 | ||