[PATCH 15/15] drm: Fix drm_mode_objecte_get() return values

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Tue Mar 13 03:35:52 PDT 2012


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Change drm_mode_object_get() to return -ENOMEM if idr_pre_get() fails,
and also handle -ENOSPC from idr_get_new_above().

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/drm_crtc.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 12333ca..8f66a15 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -227,7 +227,7 @@ static int drm_mode_object_get(struct drm_device *dev,
 	do {
 		if (idr_pre_get(&dev->mode_config.crtc_idr, GFP_KERNEL) == 0) {
 			DRM_ERROR("Ran out memory getting a mode number\n");
-			return -EINVAL;
+			return -ENOMEM;
 		}
 
 		mutex_lock(&dev->mode_config.idr_mutex);
@@ -236,6 +236,9 @@ static int drm_mode_object_get(struct drm_device *dev,
 		mutex_unlock(&dev->mode_config.idr_mutex);
 	} while (ret == -EAGAIN);
 
+	if (ret)
+		return ret;
+
 	obj->id = new_id;
 	obj->type = obj_type;
 	return 0;
-- 
1.7.3.4



More information about the dri-devel mailing list