#if DRM_DEBUG_MEMORY 
#ifdef DRM_DEBUG_MEMORY 
drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size, size_t align,				dma_addr_t maxaddr){	drm_dma_handle_t *dmah;#if DRM_DEBUG_MEMORY	int area = DRM_MEM_DMA;	spin_lock(&drm_mem_lock);	if ((drm_ram_used >> PAGE_SHIFT)	    > (DRM_RAM_PERCENT * drm_ram_available) / 100) {		spin_unlock(&drm_mem_lock);		return 0;	}	spin_unlock(&drm_mem_lock);#endif	/* pci_alloc_consistent only guarantees alignment to the smallest	 * PAGE_SIZE order which is greater than or equal to the requested size.	 * Return NULL here for now to make sure nobody tries for larger alignment	 */	if (align > size)		return NULL;	if (pci_set_dma_mask(dev->pdev, maxaddr) != 0) {		DRM_ERROR("Setting pci dma mask failed\n");		return NULL;	}	dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL);	if (!dmah)		return NULL;		dmah->size = size;	dmah->vaddr = pci_alloc_consistent(dev->pdev, size, &dmah->busaddr);#if DRM_DEBUG_MEMORY	if (dmah->vaddr == NULL) {		spin_lock(&drm_mem_lock);		++drm_mem_stats[area].fail_count;		spin_unlock(&drm_mem_lock);		kfree(dmah);		return NULL;	}	spin_lock(&drm_mem_lock);	++drm_mem_stats[area].succeed_count;	drm_mem_stats[area].bytes_allocated += size;	drm_ram_used += size;	spin_unlock(&drm_mem_lock);#else	if (dmah->vaddr == NULL) {		kfree(dmah);		return NULL;	}#endif	memset(dmah->vaddr, 0, size);	return dmah;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/aa0ca6b4bb818406d4769edb9ff115500c8e4090/drm_pci.c/buggy/drivers/char/drm/drm_pci.c