[PATCH 13/15] drm: Eliminate pointless goto
ville.syrjala at linux.intel.com
ville.syrjala at linux.intel.com
Tue Mar 13 03:35:50 PDT 2012
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
Use a do {} while() loop instead of a goto in drm_mode_object_get().
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
drivers/gpu/drm/drm_crtc.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d2d9dc5..12333ca 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -224,17 +224,17 @@ static int drm_mode_object_get(struct drm_device *dev,
int new_id = 0;
int ret;
-again:
- if (idr_pre_get(&dev->mode_config.crtc_idr, GFP_KERNEL) == 0) {
- DRM_ERROR("Ran out memory getting a mode number\n");
- return -EINVAL;
- }
+ 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;
+ }
- mutex_lock(&dev->mode_config.idr_mutex);
- ret = idr_get_new_above(&dev->mode_config.crtc_idr, obj, 1, &new_id);
- mutex_unlock(&dev->mode_config.idr_mutex);
- if (ret == -EAGAIN)
- goto again;
+ mutex_lock(&dev->mode_config.idr_mutex);
+ ret = idr_get_new_above(&dev->mode_config.crtc_idr,
+ obj, 1, &new_id);
+ mutex_unlock(&dev->mode_config.idr_mutex);
+ } while (ret == -EAGAIN);
obj->id = new_id;
obj->type = obj_type;
--
1.7.3.4
More information about the dri-devel
mailing list