int drm_ctxbitmap_next( drm_device_t *dev ) 
static int drm_ctxbitmap_next( drm_device_t *dev ) 
int drm_ctxbitmap_next( drm_device_t *dev ){	int bit;	if(!dev->ctx_bitmap) return -1;	down(&dev->struct_sem);	bit = find_first_zero_bit( dev->ctx_bitmap, DRM_MAX_CTXBITMAP );	if ( bit < DRM_MAX_CTXBITMAP ) {		set_bit( bit, dev->ctx_bitmap );	   	DRM_DEBUG( "drm_ctxbitmap_next bit : %d\n", bit );		if((bit+1) > dev->max_context) {			dev->max_context = (bit+1);			if(dev->context_sareas) {				drm_map_t **ctx_sareas;				ctx_sareas = drm_realloc(dev->context_sareas,						(dev->max_context - 1) * 						sizeof(*dev->context_sareas),						dev->max_context * 						sizeof(*dev->context_sareas),						DRM_MEM_MAPS);				if(!ctx_sareas) {					clear_bit(bit, dev->ctx_bitmap);					up(&dev->struct_sem);					return -1;				}				dev->context_sareas = ctx_sareas;				dev->context_sareas[bit] = NULL;			} else {				/* max_context == 1 at this point */				dev->context_sareas = drm_alloc(						dev->max_context * 						sizeof(*dev->context_sareas),						DRM_MEM_MAPS);				if(!dev->context_sareas) {					clear_bit(bit, dev->ctx_bitmap);					up(&dev->struct_sem);					return -1;				}				dev->context_sareas[bit] = NULL;			}		}		up(&dev->struct_sem);		return bit;	}	up(&dev->struct_sem);	return -1;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c94f70298529d99ac6e1ee7709f61eab00adeb39/drm_context.c/buggy/drivers/char/drm/drm_context.c