]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm: re-enable error handling
authorNicholas Mc Guire <hofrat@osadl.org>
Sat, 14 Jul 2018 12:32:12 +0000 (14:32 +0200)
committerSean Paul <seanpaul@chromium.org>
Mon, 16 Jul 2018 14:01:19 +0000 (10:01 -0400)
drm_legacy_ctxbitmap_next() returns idr_alloc() which can return
-ENOMEM, -EINVAL or -ENOSPC none of which are -1 . but the call sites
of drm_legacy_ctxbitmap_next() seem to be assuming that the error case
would be -1 (original return of drm_ctxbitmap_next() prior to 2.6.23
was actually -1). Thus reenable error handling by checking for < 0.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: 62968144e673 ("drm: convert drm context code to use Linux idr")
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1531571532-22733-1-git-send-email-hofrat@osadl.org
drivers/gpu/drm/drm_context.c

index 3c4000facb360a012f78b12599d918a276145ca6..f973d287696a6febd621f8bf1ff32d5fc64bdca2 100644 (file)
@@ -372,7 +372,7 @@ int drm_legacy_addctx(struct drm_device *dev, void *data,
                ctx->handle = drm_legacy_ctxbitmap_next(dev);
        }
        DRM_DEBUG("%d\n", ctx->handle);
-       if (ctx->handle == -1) {
+       if (ctx->handle < 0) {
                DRM_DEBUG("Not enough free contexts.\n");
                /* Should this return -EBUSY instead? */
                return -ENOMEM;