FreeBSD/sys/dev/drm2/radeon/radeon_cs.c
/**
 * cs_parser_fini() - clean parser states
 * @parser:	parser structure holding parsing context.
 * @error:	error number
 *
 * If error is set than unvalidate buffer, otherwise just free memory
 * used by parsing context.
 **/


If error is set than unvalidate buffer, otherwise just free memory
used by parsing context.
If error is set than unvalidate buffer otherwise just free memory used by parsing context .
static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error)
{
	unsigned i;
	if (!error) {
		ttm_eu_fence_buffer_objects(&parser->validated,
					    parser->ib.fence);
	} else {
		ttm_eu_backoff_reservation(&parser->validated);
	}
	if (parser->relocs != NULL) {
		for (i = 0; i < parser->nrelocs; i++) {
			if (parser->relocs[i].gobj)
				drm_gem_object_unreference_unlocked(parser->relocs[i].gobj);
		}
	}
	free(parser->track, DRM_MEM_DRIVER);
	free(parser->relocs, DRM_MEM_DRIVER);
	free(parser->relocs_ptr, DRM_MEM_DRIVER);
	for (i = 0; i < parser->nchunks; i++) {
		free(parser->chunks[i].kdata, DRM_MEM_DRIVER);
		if ((parser->rdev->flags & RADEON_IS_AGP)) {
			free(parser->chunks[i].kpage[0], DRM_MEM_DRIVER);
			free(parser->chunks[i].kpage[1], DRM_MEM_DRIVER);
		}
	}
	free(parser->chunks, DRM_MEM_DRIVER);
	free(parser->chunks_array, DRM_MEM_DRIVER);
	radeon_ib_free(parser->rdev, &parser->ib);
	radeon_ib_free(parser->rdev, &parser->const_ib);
}
static void radeon_cs_parser_fini ( struct radeon_cs_parser * parser , int error ) { unsigned i ; if ( ! error ) { ttm_eu_fence_buffer_objects ( & parser -> validated , parser -> ib . fence ) ; } else { ttm_eu_backoff_reservation ( & parser -> validated ) ; } if ( parser -> relocs != NULL ) { for ( i = 0 ; i < parser -> nrelocs ; i ++ ) { if ( parser -> relocs [ i ] . gobj ) drm_gem_object_unreference_unlocked ( parser -> relocs [ i ] . gobj ) ; } } free ( parser -> track , DRM_MEM_DRIVER ) ; free ( parser -> relocs , DRM_MEM_DRIVER ) ; free ( parser -> relocs_ptr , DRM_MEM_DRIVER ) ; for ( i = 0 ; i < parser -> nchunks ; i ++ ) { free ( parser -> chunks [ i ] . kdata , DRM_MEM_DRIVER ) ; if ( ( parser -> rdev -> flags & RADEON_IS_AGP ) ) { free ( parser -> chunks [ i ] . kpage [ 0 ] , DRM_MEM_DRIVER ) ; free ( parser -> chunks [ i ] . kpage [ 1 ] , DRM_MEM_DRIVER ) ; } } free ( parser -> chunks , DRM_MEM_DRIVER ) ; free ( parser -> chunks_array , DRM_MEM_DRIVER ) ; radeon_ib_free ( parser -> rdev , & parser -> ib ) ; radeon_ib_free ( parser -> rdev , & parser -> const_ib ) ; }
cs_parser_fini() - clean parser states
 @parser:     parser structure holding parsing context.
cs_parser_fini () - clean parser states @parser : parser structure holding parsing context .