提交 8f7da157 编写于 作者: T Thierry Reding

gpu: host1x: Cleanup on initialization failure

When an error happens during the initialization of one of the sub-
devices, make sure to properly cleanup all sub-devices that have been
initialized up to that point.
Signed-off-by: NThierry Reding <treding@nvidia.com>
上级 1f876c3f
...@@ -211,8 +211,7 @@ int host1x_device_init(struct host1x_device *device) ...@@ -211,8 +211,7 @@ int host1x_device_init(struct host1x_device *device)
dev_err(&device->dev, dev_err(&device->dev,
"failed to initialize %s: %d\n", "failed to initialize %s: %d\n",
dev_name(client->dev), err); dev_name(client->dev), err);
mutex_unlock(&device->clients_lock); goto teardown;
return err;
} }
} }
} }
...@@ -220,6 +219,14 @@ int host1x_device_init(struct host1x_device *device) ...@@ -220,6 +219,14 @@ int host1x_device_init(struct host1x_device *device)
mutex_unlock(&device->clients_lock); mutex_unlock(&device->clients_lock);
return 0; return 0;
teardown:
list_for_each_entry_continue_reverse(client, &device->clients, list)
if (client->ops->exit)
client->ops->exit(client);
mutex_unlock(&device->clients_lock);
return err;
} }
EXPORT_SYMBOL(host1x_device_init); EXPORT_SYMBOL(host1x_device_init);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册