提交 587680c1 编写于 作者: C Christophe JAILLET 提交者: Daniel Vetter

drm: Release resources with a safer function

We should use 'ida_simple_remove()' instead of 'ida_remove()' when freeing
resources allocated with 'ida_simple_get()'.

This as been spotted with the following coccinelle script which tries to
detect missing 'ida_simple_remove()' call in error handling paths.

///////////////
@@
expression x;
identifier l;
@@

*   x = ida_simple_get(...);
    ...
    if (...) {
    ...
    }
    ...
    if (...) {
       ...
       goto l;
    }
    ...
*   l: ... when != ida_simple_remove(...);
Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1475388082-12656-1-git-send-email-christophe.jaillet@wanadoo.fr
上级 0546d685
...@@ -250,10 +250,10 @@ int drm_connector_init(struct drm_device *dev, ...@@ -250,10 +250,10 @@ int drm_connector_init(struct drm_device *dev,
connector->debugfs_entry = NULL; connector->debugfs_entry = NULL;
out_put_type_id: out_put_type_id:
if (ret) if (ret)
ida_remove(connector_ida, connector->connector_type_id); ida_simple_remove(connector_ida, connector->connector_type_id);
out_put_id: out_put_id:
if (ret) if (ret)
ida_remove(&config->connector_ida, connector->index); ida_simple_remove(&config->connector_ida, connector->index);
out_put: out_put:
if (ret) if (ret)
drm_mode_object_unregister(dev, &connector->base); drm_mode_object_unregister(dev, &connector->base);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册