diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2016-10-02 02:01:22 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-10-05 09:16:54 -0400 |
commit | 587680c1c52d73bc7d5dbba2dcfadacb7a3f6b0e (patch) | |
tree | 0706cf37def55b3a4a37b2b2e51f5f7899101a05 /drivers/gpu | |
parent | 0546d685f07cc4fc5748fd36e57d167877c2842d (diff) |
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: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1475388082-12656-1-git-send-email-christophe.jaillet@wanadoo.fr
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/drm_connector.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 26bb78c76481..2e7430283043 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c | |||
@@ -250,10 +250,10 @@ int drm_connector_init(struct drm_device *dev, | |||
250 | connector->debugfs_entry = NULL; | 250 | connector->debugfs_entry = NULL; |
251 | out_put_type_id: | 251 | out_put_type_id: |
252 | if (ret) | 252 | if (ret) |
253 | ida_remove(connector_ida, connector->connector_type_id); | 253 | ida_simple_remove(connector_ida, connector->connector_type_id); |
254 | out_put_id: | 254 | out_put_id: |
255 | if (ret) | 255 | if (ret) |
256 | ida_remove(&config->connector_ida, connector->index); | 256 | ida_simple_remove(&config->connector_ida, connector->index); |
257 | out_put: | 257 | out_put: |
258 | if (ret) | 258 | if (ret) |
259 | drm_mode_object_unregister(dev, &connector->base); | 259 | drm_mode_object_unregister(dev, &connector->base); |