blob: 597ba7077668a26e4493679486c3d8a88f105bbc [file] [log] [blame]
Alex Elderb09c94a2014-10-01 21:54:16 -05001/*
Viresh Kumara93db2d2015-04-01 20:32:02 +05302 * Greybus manifest parsing
Alex Elderb09c94a2014-10-01 21:54:16 -05003 *
Alex Elderd8187aa2015-03-27 15:06:24 -05004 * Copyright 2014-2015 Google Inc.
5 * Copyright 2014-2015 Linaro Ltd.
Alex Elderb09c94a2014-10-01 21:54:16 -05006 *
7 * Released under the GPLv2 only.
8 */
9
10#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
11
12#include <linux/err.h>
13
14#include "greybus.h"
15
Viresh Kumar19b3b2c2015-03-24 17:08:13 +053016static const char *get_descriptor_type_string(u8 type)
17{
18 switch(type) {
19 case GREYBUS_TYPE_INVALID:
20 return "invalid";
Viresh Kumar19b3b2c2015-03-24 17:08:13 +053021 case GREYBUS_TYPE_STRING:
22 return "string";
23 case GREYBUS_TYPE_INTERFACE:
24 return "interface";
25 case GREYBUS_TYPE_CPORT:
26 return "cport";
Viresh Kumar83a0cb52015-04-01 20:31:59 +053027 case GREYBUS_TYPE_BUNDLE:
28 return "bundle";
Viresh Kumar19b3b2c2015-03-24 17:08:13 +053029 default:
30 WARN_ON(1);
31 return "unknown";
32 }
33}
34
Alex Elderb09c94a2014-10-01 21:54:16 -050035/*
36 * We scan the manifest once to identify where all the descriptors
37 * are. The result is a list of these manifest_desc structures. We
38 * then pick through them for what we're looking for (starting with
Viresh Kumara93db2d2015-04-01 20:32:02 +053039 * the interface descriptor). As each is processed we remove it from
Alex Elderb09c94a2014-10-01 21:54:16 -050040 * the list. When we're done the list should (probably) be empty.
41 */
42struct manifest_desc {
43 struct list_head links;
44
45 size_t size;
46 void *data;
47 enum greybus_descriptor_type type;
48};
49
Alex Elderb09c94a2014-10-01 21:54:16 -050050static void release_manifest_descriptor(struct manifest_desc *descriptor)
51{
52 list_del(&descriptor->links);
53 kfree(descriptor);
54}
55
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -080056static void release_manifest_descriptors(struct gb_interface *intf)
Alex Elderb09c94a2014-10-01 21:54:16 -050057{
58 struct manifest_desc *descriptor;
59 struct manifest_desc *next;
60
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -080061 list_for_each_entry_safe(descriptor, next, &intf->manifest_descs, links)
Alex Elderb09c94a2014-10-01 21:54:16 -050062 release_manifest_descriptor(descriptor);
63}
64
65/*
66 * Validate the given descriptor. Its reported size must fit within
Viresh Kumar696e0cc2014-11-21 11:26:30 +053067 * the number of bytes remaining, and it must have a recognized
Alex Elderb09c94a2014-10-01 21:54:16 -050068 * type. Check that the reported size is at least as big as what
69 * we expect to see. (It could be bigger, perhaps for a new version
70 * of the format.)
71 *
72 * Returns the number of bytes consumed by the descriptor, or a
73 * negative errno.
74 */
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -080075static int identify_descriptor(struct gb_interface *intf,
76 struct greybus_descriptor *desc, size_t size)
Alex Elderb09c94a2014-10-01 21:54:16 -050077{
78 struct greybus_descriptor_header *desc_header = &desc->header;
79 struct manifest_desc *descriptor;
Alex Elderd8187aa2015-03-27 15:06:24 -050080 size_t desc_size;
Alex Elderb09c94a2014-10-01 21:54:16 -050081 size_t expected_size;
82
83 if (size < sizeof(*desc_header)) {
84 pr_err("manifest too small\n");
85 return -EINVAL; /* Must at least have header */
86 }
87
Alex Elderd8187aa2015-03-27 15:06:24 -050088 desc_size = le16_to_cpu(desc_header->size);
89 if (desc_size > size) {
Alex Elderb09c94a2014-10-01 21:54:16 -050090 pr_err("descriptor too big\n");
91 return -EINVAL;
92 }
93
Viresh Kumar19b3b2c2015-03-24 17:08:13 +053094 /* Descriptor needs to at least have a header */
95 expected_size = sizeof(*desc_header);
96
Alex Elderb09c94a2014-10-01 21:54:16 -050097 switch (desc_header->type) {
Alex Elderb09c94a2014-10-01 21:54:16 -050098 case GREYBUS_TYPE_STRING:
Alex Elderb09c94a2014-10-01 21:54:16 -050099 expected_size += sizeof(struct greybus_descriptor_string);
Viresh Kumar19b3b2c2015-03-24 17:08:13 +0530100 expected_size += desc->string.length;
Viresh Kumarfa2fbf12015-04-28 19:51:35 +0530101
102 /* String descriptors are padded to 4 byte boundaries */
103 expected_size = ALIGN(expected_size, 4);
Alex Elderb09c94a2014-10-01 21:54:16 -0500104 break;
Alex Elder63cc9322014-10-02 12:30:02 -0500105 case GREYBUS_TYPE_INTERFACE:
Viresh Kumara93db2d2015-04-01 20:32:02 +0530106 expected_size += sizeof(struct greybus_descriptor_interface);
Alex Elder63cc9322014-10-02 12:30:02 -0500107 break;
Viresh Kumar7c183f72015-04-01 20:32:00 +0530108 case GREYBUS_TYPE_BUNDLE:
109 expected_size += sizeof(struct greybus_descriptor_bundle);
110 break;
Alex Elderb09c94a2014-10-01 21:54:16 -0500111 case GREYBUS_TYPE_CPORT:
Viresh Kumar19b3b2c2015-03-24 17:08:13 +0530112 expected_size += sizeof(struct greybus_descriptor_cport);
Alex Elderb09c94a2014-10-01 21:54:16 -0500113 break;
114 case GREYBUS_TYPE_INVALID:
115 default:
116 pr_err("invalid descriptor type (%hhu)\n", desc_header->type);
117 return -EINVAL;
118 }
119
Viresh Kumar19b3b2c2015-03-24 17:08:13 +0530120 if (desc_size < expected_size) {
Alex Elderd8187aa2015-03-27 15:06:24 -0500121 pr_err("%s descriptor too small (%zu < %zu)\n",
Viresh Kumar19b3b2c2015-03-24 17:08:13 +0530122 get_descriptor_type_string(desc_header->type),
123 desc_size, expected_size);
124 return -EINVAL;
125 }
126
Viresh Kumar55b930c2015-04-29 11:02:08 +0530127 /* Descriptor bigger than what we expect */
128 if (desc_size > expected_size) {
129 pr_warn("%s descriptor size mismatch (want %zu got %zu)\n",
130 get_descriptor_type_string(desc_header->type),
131 expected_size, desc_size);
132 }
133
Alex Elderb09c94a2014-10-01 21:54:16 -0500134 descriptor = kzalloc(sizeof(*descriptor), GFP_KERNEL);
135 if (!descriptor)
136 return -ENOMEM;
137
138 descriptor->size = desc_size;
Matt Porter7a13e2f2014-10-06 09:58:44 -0400139 descriptor->data = (u8 *)desc + sizeof(*desc_header);
Alex Elderb09c94a2014-10-01 21:54:16 -0500140 descriptor->type = desc_header->type;
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -0800141 list_add_tail(&descriptor->links, &intf->manifest_descs);
Alex Elderb09c94a2014-10-01 21:54:16 -0500142
Alex Elderd8187aa2015-03-27 15:06:24 -0500143 /* desc_size is is positive and is known to fit in a signed int */
144
Alex Elderb09c94a2014-10-01 21:54:16 -0500145 return desc_size;
146}
147
148/*
149 * Find the string descriptor having the given id, validate it, and
150 * allocate a duplicate copy of it. The duplicate has an extra byte
151 * which guarantees the returned string is NUL-terminated.
152 *
153 * String index 0 is valid (it represents "no string"), and for
154 * that a null pointer is returned.
155 *
156 * Otherwise returns a pointer to a newly-allocated copy of the
157 * descriptor string, or an error-coded pointer on failure.
158 */
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -0800159static char *gb_string_get(struct gb_interface *intf, u8 string_id)
Alex Elderb09c94a2014-10-01 21:54:16 -0500160{
161 struct greybus_descriptor_string *desc_string;
162 struct manifest_desc *descriptor;
163 bool found = false;
164 char *string;
165
166 /* A zero string id means no string (but no error) */
167 if (!string_id)
168 return NULL;
169
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -0800170 list_for_each_entry(descriptor, &intf->manifest_descs, links) {
Alex Elderb09c94a2014-10-01 21:54:16 -0500171
172 if (descriptor->type != GREYBUS_TYPE_STRING)
173 continue;
174
Matt Porter7a13e2f2014-10-06 09:58:44 -0400175 desc_string = descriptor->data;
Alex Elderb09c94a2014-10-01 21:54:16 -0500176 if (desc_string->id == string_id) {
177 found = true;
178 break;
179 }
180 }
181 if (!found)
182 return ERR_PTR(-ENOENT);
183
184 /* Allocate an extra byte so we can guarantee it's NUL-terminated */
185 string = kmemdup(&desc_string->string, (size_t)desc_string->length + 1,
186 GFP_KERNEL);
187 if (!string)
188 return ERR_PTR(-ENOMEM);
189 string[desc_string->length] = '\0';
190
191 /* Ok we've used this string, so we're done with it */
192 release_manifest_descriptor(descriptor);
193
194 return string;
195}
196
Alex Elderd88bfb52014-10-01 21:54:17 -0500197/*
Alex Elderc095bbc2014-10-01 21:54:18 -0500198 * Find cport descriptors in the manifest and set up data structures
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -0500199 * for the functions that use them. Returns the number of bundles
200 * set up for the given interface, or 0 if there is an error.
Alex Elderc095bbc2014-10-01 21:54:18 -0500201 */
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -0800202static u32 gb_manifest_parse_cports(struct gb_interface *intf,
203 struct gb_bundle *bundle)
Alex Elderc095bbc2014-10-01 21:54:18 -0500204{
205 u32 count = 0;
206
207 while (true) {
208 struct manifest_desc *descriptor;
209 struct greybus_descriptor_cport *desc_cport;
Alex Elder7fba0072014-10-28 19:35:59 -0500210 u8 protocol_id;
Alex Elderc095bbc2014-10-01 21:54:18 -0500211 u16 cport_id;
Viresh Kumar4ed16a82014-11-13 18:14:31 +0530212 bool found = false;
Alex Elderc095bbc2014-10-01 21:54:18 -0500213
214 /* Find a cport descriptor */
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -0800215 list_for_each_entry(descriptor, &intf->manifest_descs, links) {
Alex Elderc095bbc2014-10-01 21:54:18 -0500216 if (descriptor->type == GREYBUS_TYPE_CPORT) {
Alex Elder63cc9322014-10-02 12:30:02 -0500217 desc_cport = descriptor->data;
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -0500218 if (desc_cport->bundle == bundle->id) {
Alex Elder63cc9322014-10-02 12:30:02 -0500219 found = true;
220 break;
221 }
Alex Elderc095bbc2014-10-01 21:54:18 -0500222 }
223 }
224 if (!found)
225 break;
226
227 /* Found one. Set up its function structure */
Alex Elder7fba0072014-10-28 19:35:59 -0500228 protocol_id = desc_cport->protocol_id;
Alex Elderc095bbc2014-10-01 21:54:18 -0500229 cport_id = le16_to_cpu(desc_cport->id);
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -0500230 if (!gb_connection_create(bundle, cport_id, protocol_id))
Alex Elderc095bbc2014-10-01 21:54:18 -0500231 return 0; /* Error */
232
233 count++;
234 /* Release the cport descriptor */
235 release_manifest_descriptor(descriptor);
236 }
237
238 return count;
239}
240
241/*
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -0500242 * Find bundle descriptors in the manifest and set up their data
243 * structures. Returns the number of bundles set up for the
Viresh Kumar7c183f72015-04-01 20:32:00 +0530244 * given interface.
Alex Elderd88bfb52014-10-01 21:54:17 -0500245 */
Greg Kroah-Hartman4ab9b3c2014-12-19 14:56:31 -0800246static u32 gb_manifest_parse_bundles(struct gb_interface *intf)
Alex Elderd88bfb52014-10-01 21:54:17 -0500247{
248 u32 count = 0;
249
250 while (true) {
251 struct manifest_desc *descriptor;
Viresh Kumar7c183f72015-04-01 20:32:00 +0530252 struct greybus_descriptor_bundle *desc_bundle;
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -0500253 struct gb_bundle *bundle;
Alex Elderd88bfb52014-10-01 21:54:17 -0500254 bool found = false;
255
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -0500256 /* Find an bundle descriptor */
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -0800257 list_for_each_entry(descriptor, &intf->manifest_descs, links) {
Viresh Kumar7c183f72015-04-01 20:32:00 +0530258 if (descriptor->type == GREYBUS_TYPE_BUNDLE) {
Alex Elderd88bfb52014-10-01 21:54:17 -0500259 found = true;
260 break;
261 }
262 }
263 if (!found)
264 break;
265
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -0500266 /* Found one. Set up its bundle structure*/
Viresh Kumar7c183f72015-04-01 20:32:00 +0530267 desc_bundle = descriptor->data;
268 bundle = gb_bundle_create(intf, desc_bundle->id,
Viresh Kumar88e6d372015-04-06 15:49:36 +0530269 desc_bundle->class);
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -0500270 if (!bundle)
Alex Elderd88bfb52014-10-01 21:54:17 -0500271 return 0; /* Error */
Alex Elderc095bbc2014-10-01 21:54:18 -0500272
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -0500273 /* Now go set up this bundle's functions and cports */
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -0800274 if (!gb_manifest_parse_cports(intf, bundle))
Alex Elderc095bbc2014-10-01 21:54:18 -0500275 return 0; /* Error parsing cports */
276
Alex Elderd88bfb52014-10-01 21:54:17 -0500277 count++;
278
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -0500279 /* Done with this bundle descriptor */
Alex Elderd88bfb52014-10-01 21:54:17 -0500280 release_manifest_descriptor(descriptor);
281 }
282
283 return count;
284}
285
Viresh Kumara93db2d2015-04-01 20:32:02 +0530286static bool gb_manifest_parse_interface(struct gb_interface *intf,
287 struct manifest_desc *interface_desc)
Alex Elderb09c94a2014-10-01 21:54:16 -0500288{
Viresh Kumara93db2d2015-04-01 20:32:02 +0530289 struct greybus_descriptor_interface *desc_intf = interface_desc->data;
Alex Elderb09c94a2014-10-01 21:54:16 -0500290
291 /* Handle the strings first--they can fail */
Viresh Kumara93db2d2015-04-01 20:32:02 +0530292 intf->vendor_string = gb_string_get(intf, desc_intf->vendor_stringid);
Greg Kroah-Hartman4ab9b3c2014-12-19 14:56:31 -0800293 if (IS_ERR(intf->vendor_string))
Alex Elder937d0da2014-10-03 14:14:25 -0500294 return false;
295
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -0800296 intf->product_string = gb_string_get(intf,
Viresh Kumara93db2d2015-04-01 20:32:02 +0530297 desc_intf->product_stringid);
Greg Kroah-Hartman4ab9b3c2014-12-19 14:56:31 -0800298 if (IS_ERR(intf->product_string)) {
Viresh Kumar50fc08f2014-11-13 18:14:32 +0530299 goto out_free_vendor_string;
Alex Elderb09c94a2014-10-01 21:54:16 -0500300 }
301
Viresh Kumar8a5286e2015-04-28 19:51:37 +0530302 // FIXME
303 // Vendor, Product and Unique id must come via control protocol
304 intf->vendor = 0xffff;
305 intf->product = 0x0001;
306 intf->unique_id = 0;
Alex Elderb09c94a2014-10-01 21:54:16 -0500307
Viresh Kumara93db2d2015-04-01 20:32:02 +0530308 /* Release the interface descriptor, now that we're done with it */
309 release_manifest_descriptor(interface_desc);
Alex Elderb09c94a2014-10-01 21:54:16 -0500310
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -0500311 /* An interface must have at least one bundle descriptor */
Greg Kroah-Hartman4ab9b3c2014-12-19 14:56:31 -0800312 if (!gb_manifest_parse_bundles(intf)) {
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -0500313 pr_err("manifest bundle descriptors not valid\n");
Alex Elder937d0da2014-10-03 14:14:25 -0500314 goto out_err;
Alex Elderd88bfb52014-10-01 21:54:17 -0500315 }
316
Alex Elder937d0da2014-10-03 14:14:25 -0500317 return true;
318out_err:
Greg Kroah-Hartman4ab9b3c2014-12-19 14:56:31 -0800319 kfree(intf->product_string);
320 intf->product_string = NULL;
Viresh Kumar50fc08f2014-11-13 18:14:32 +0530321out_free_vendor_string:
Greg Kroah-Hartman4ab9b3c2014-12-19 14:56:31 -0800322 kfree(intf->vendor_string);
323 intf->vendor_string = NULL;
Alex Elder937d0da2014-10-03 14:14:25 -0500324
325 return false;
Alex Elderb09c94a2014-10-01 21:54:16 -0500326}
327
328/*
Viresh Kumara93db2d2015-04-01 20:32:02 +0530329 * Parse a buffer containing a Interface manifest.
Alex Elderb09c94a2014-10-01 21:54:16 -0500330 *
331 * If we find anything wrong with the content/format of the buffer
332 * we reject it.
333 *
334 * The first requirement is that the manifest's version is
335 * one we can parse.
336 *
337 * We make an initial pass through the buffer and identify all of
338 * the descriptors it contains, keeping track for each its type
339 * and the location size of its data in the buffer.
340 *
Viresh Kumara93db2d2015-04-01 20:32:02 +0530341 * Next we scan the descriptors, looking for a interface descriptor;
Alex Elderb09c94a2014-10-01 21:54:16 -0500342 * there must be exactly one of those. When found, we record the
343 * information it contains, and then remove that descriptor (and any
344 * string descriptors it refers to) from further consideration.
345 *
Greg Kroah-Hartman4ab9b3c2014-12-19 14:56:31 -0800346 * After that we look for the interface's bundles--there must be at
Alex Elderb09c94a2014-10-01 21:54:16 -0500347 * least one of those.
348 *
Alex Elder937d0da2014-10-03 14:14:25 -0500349 * Returns true if parsing was successful, false otherwise.
Alex Elderb09c94a2014-10-01 21:54:16 -0500350 */
Greg Kroah-Hartman4ab9b3c2014-12-19 14:56:31 -0800351bool gb_manifest_parse(struct gb_interface *intf, void *data, size_t size)
Alex Elderb09c94a2014-10-01 21:54:16 -0500352{
353 struct greybus_manifest *manifest;
354 struct greybus_manifest_header *header;
355 struct greybus_descriptor *desc;
356 struct manifest_desc *descriptor;
Viresh Kumara93db2d2015-04-01 20:32:02 +0530357 struct manifest_desc *interface_desc = NULL;
Alex Elderb09c94a2014-10-01 21:54:16 -0500358 u16 manifest_size;
359 u32 found = 0;
Viresh Kumar43d94312014-11-13 18:14:30 +0530360 bool result;
Alex Elderb09c94a2014-10-01 21:54:16 -0500361
Viresh Kumar1dd90df2014-11-14 17:25:03 +0530362 /* Manifest descriptor list should be empty here */
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -0800363 if (WARN_ON(!list_empty(&intf->manifest_descs)))
Viresh Kumar1dd90df2014-11-14 17:25:03 +0530364 return false;
365
Alex Elderb09c94a2014-10-01 21:54:16 -0500366 /* we have to have at _least_ the manifest header */
367 if (size <= sizeof(manifest->header)) {
368 pr_err("short manifest (%zu)\n", size);
Alex Elder937d0da2014-10-03 14:14:25 -0500369 return false;
Alex Elderb09c94a2014-10-01 21:54:16 -0500370 }
371
372 /* Make sure the size is right */
373 manifest = data;
374 header = &manifest->header;
375 manifest_size = le16_to_cpu(header->size);
376 if (manifest_size != size) {
377 pr_err("manifest size mismatch %zu != %hu\n",
378 size, manifest_size);
Alex Elder937d0da2014-10-03 14:14:25 -0500379 return false;
Alex Elderb09c94a2014-10-01 21:54:16 -0500380 }
381
382 /* Validate major/minor number */
383 if (header->version_major > GREYBUS_VERSION_MAJOR) {
384 pr_err("manifest version too new (%hhu.%hhu > %hhu.%hhu)\n",
385 header->version_major, header->version_minor,
386 GREYBUS_VERSION_MAJOR, GREYBUS_VERSION_MINOR);
Alex Elder937d0da2014-10-03 14:14:25 -0500387 return false;
Alex Elderb09c94a2014-10-01 21:54:16 -0500388 }
389
390 /* OK, find all the descriptors */
391 desc = (struct greybus_descriptor *)(header + 1);
392 size -= sizeof(*header);
393 while (size) {
394 int desc_size;
395
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -0800396 desc_size = identify_descriptor(intf, desc, size);
Viresh Kumar13fe6a92015-03-24 17:08:14 +0530397 if (desc_size < 0) {
Matt Porterff8aed52014-10-06 13:46:36 -0400398 result = false;
Alex Elder937d0da2014-10-03 14:14:25 -0500399 goto out;
Alex Elderb09c94a2014-10-01 21:54:16 -0500400 }
401 desc = (struct greybus_descriptor *)((char *)desc + desc_size);
402 size -= desc_size;
Greg Kroah-Hartman86bf33a2014-11-14 14:37:56 -0800403 }
Alex Elderb09c94a2014-10-01 21:54:16 -0500404
Viresh Kumara93db2d2015-04-01 20:32:02 +0530405 /* There must be a single interface descriptor */
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -0800406 list_for_each_entry(descriptor, &intf->manifest_descs, links) {
Viresh Kumara93db2d2015-04-01 20:32:02 +0530407 if (descriptor->type == GREYBUS_TYPE_INTERFACE)
Greg Kroah-Hartman86bf33a2014-11-14 14:37:56 -0800408 if (!found++)
Viresh Kumara93db2d2015-04-01 20:32:02 +0530409 interface_desc = descriptor;
Greg Kroah-Hartman86bf33a2014-11-14 14:37:56 -0800410 }
411 if (found != 1) {
Viresh Kumara93db2d2015-04-01 20:32:02 +0530412 pr_err("manifest must have 1 interface descriptor (%u found)\n",
Greg Kroah-Hartman86bf33a2014-11-14 14:37:56 -0800413 found);
414 result = false;
415 goto out;
Alex Elderb09c94a2014-10-01 21:54:16 -0500416 }
417
Viresh Kumara93db2d2015-04-01 20:32:02 +0530418 /* Parse the manifest, starting with the interface descriptor */
419 result = gb_manifest_parse_interface(intf, interface_desc);
Alex Elderb09c94a2014-10-01 21:54:16 -0500420
421 /*
422 * We really should have no remaining descriptors, but we
423 * don't know what newer format manifests might leave.
424 */
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -0800425 if (result && !list_empty(&intf->manifest_descs))
Viresh Kumara93db2d2015-04-01 20:32:02 +0530426 pr_info("excess descriptors in interface manifest\n");
Alex Elder937d0da2014-10-03 14:14:25 -0500427out:
Greg Kroah-Hartman86cad662014-12-23 15:16:50 -0800428 release_manifest_descriptors(intf);
Alex Elderb09c94a2014-10-01 21:54:16 -0500429
Matt Porterff8aed52014-10-06 13:46:36 -0400430 return result;
Alex Elderb09c94a2014-10-01 21:54:16 -0500431}