drm: introduce drm_dev_free() to fix error paths
authorDavid Herrmann <dh.herrmann@gmail.com>
Wed, 2 Oct 2013 09:23:37 +0000 (11:23 +0200)
committerDave Airlie <airlied@redhat.com>
Wed, 9 Oct 2013 05:55:09 +0000 (15:55 +1000)
commit0dc8fe5985e01f238e7dc64ff1733cc0291811e8
tree977b912c062fee10c10e39082546a5ecacd39792
parent1c8887dd01d97781471c9a876e3a4e804bb33f31
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>
drivers/gpu/drm/drm_pci.c
drivers/gpu/drm/drm_platform.c
drivers/gpu/drm/drm_stub.c
drivers/gpu/drm/drm_usb.c
include/drm/drmP.h