drm: introduce drm_dev_free() to fix error paths

The error paths in DRM bus drivers currently leak memory as they don't
correctly revert drm_dev_alloc(). Introduce drm_dev_free() to free DRM
devices which haven't been registered, yet.

We must be careful not to introduce any side-effects with cleanups done in
drm_dev_free(). drm_ht_remove(), drm_ctxbitmap_cleanup() and
drm_gem_destroy() are all fine in that regard.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
David Herrmann
2013-10-02 11:23:37 +02:00
committed by Dave Airlie
parent 1c8887dd01
commit 0dc8fe5985
5 changed files with 29 additions and 13 deletions

View File

@@ -64,7 +64,7 @@ static int drm_get_platform_dev(struct platform_device *platdev,
return 0;
err_free:
kfree(dev);
drm_dev_free(dev);
return ret;
}