/* Cleanup after an error on one of the addbufs() functions. */
static void drm_cleanup_buf_error(struct drm_device *dev, struct drm_buf_entry *entry)
/* Cleanup after an error on one of the addbufs() functions. */
static void drm_cleanup_buf_error(struct drm_device *dev, struct drm_buf_entry *entry)
{
	int i;
	if (entry->seg_count) {
		for (i = 0; i < entry->seg_count; i++) {
			if (entry->seglist[i]) {
				drm_pci_free(dev, entry->seglist[i]);
			}
		}
		kfree(entry->seglist);
		entry->seg_count = 0;
	}
	if (entry->buf_count) {
		for (i = 0; i < entry->buf_count; i++) {
			kfree(entry->buflist[i].dev_private);
		}
		kfree(entry->buflist);
		entry->buf_count = 0;
	}
}