diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2012-03-15 18:58:31 +0100 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-04-24 10:50:20 +0200 |
commit | f1ae126cdf1d1514da6e89a248232a7f7d315fe0 (patch) | |
tree | b698a6cfeb735df7873865614f5f834fbcdaace9 /drivers/gpu/drm/drm_context.c | |
parent | vga-switcheroo: select VGA arbitration. (diff) | |
download | linux-f1ae126cdf1d1514da6e89a248232a7f7d315fe0.tar.xz linux-f1ae126cdf1d1514da6e89a248232a7f7d315fe0.zip |
drm: Unify and fix idr error handling
The error handling code w.r.t. idr usage looks inconsistent.
In the case of drm_mode_object_get() and drm_ctxbitmap_next() the error
handling is also incomplete.
Unify the code to follow the same pattern always.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_context.c')
-rw-r--r-- | drivers/gpu/drm/drm_context.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c index 325365f6d355..affa629589ac 100644 --- a/drivers/gpu/drm/drm_context.c +++ b/drivers/gpu/drm/drm_context.c @@ -85,11 +85,12 @@ again: mutex_lock(&dev->struct_mutex); ret = idr_get_new_above(&dev->ctx_idr, NULL, DRM_RESERVED_CONTEXTS, &new_id); - if (ret == -EAGAIN) { - mutex_unlock(&dev->struct_mutex); - goto again; - } mutex_unlock(&dev->struct_mutex); + if (ret == -EAGAIN) + goto again; + else if (ret) + return ret; + return new_id; } |