*/
int gb_interface_init(struct gb_interface *intf)
{
+ struct gb_bundle *bundle, *tmp;
int ret, size;
void *manifest;
ret = gb_control_get_manifest_operation(intf, manifest, size);
if (ret) {
dev_err(&intf->dev, "failed to get manifest: %d\n", ret);
- goto free_manifest;
+ goto err_free_manifest;
}
/*
if (!gb_manifest_parse(intf, manifest, size)) {
dev_err(&intf->dev, "failed to parse manifest\n");
ret = -EINVAL;
- goto free_manifest;
+ goto err_destroy_bundles;
}
ret = gb_control_get_interface_version_operation(intf);
if (ret)
- goto free_manifest;
+ goto err_destroy_bundles;
ret = gb_control_get_bundle_versions(intf->control);
if (ret)
- goto free_manifest;
+ goto err_destroy_bundles;
+
+ kfree(manifest);
-free_manifest:
+ return 0;
+
+err_destroy_bundles:
+ list_for_each_entry_safe(bundle, tmp, &intf->bundles, links)
+ gb_bundle_destroy(bundle);
+err_free_manifest:
kfree(manifest);
return ret;