summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-04-05 13:12:04 +0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-04-22 17:39:42 +0400
commit10e6856983c21b76d03282b6da86709bdc23eb77 (patch)
tree4f98c7f11c36938a5976036c4b58128f2e289b13
parent8268bd48af9aae5e079d3ba8403ae459ff06cbcb (diff)
downloadlinux-10e6856983c21b76d03282b6da86709bdc23eb77.tar.xz
drm: Fix error handling in drm_master_create
We need to check whether drm_ht_create succeed and clean up if not. Spotted by coverity. Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/drm_stub.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 4c24c3ac1efa..bfa6cb949545 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -128,7 +128,10 @@ struct drm_master *drm_master_create(struct drm_minor *minor)
kref_init(&master->refcount);
spin_lock_init(&master->lock.spinlock);
init_waitqueue_head(&master->lock.lock_queue);
- drm_ht_create(&master->magiclist, DRM_MAGIC_HASH_ORDER);
+ if (drm_ht_create(&master->magiclist, DRM_MAGIC_HASH_ORDER)) {
+ kfree(master);
+ return NULL;
+ }
INIT_LIST_HEAD(&master->magicfree);
master->minor = minor;