table->icm[i] = mthca_alloc_icm(dev, MTHCA_TABLE_CHUNK_SIZE >> PAGE_SHIFT, 
chunk_size = MTHCA_TABLE_CHUNK_SIZE; if ((i + 1) * MTHCA_TABLE_CHUNK_SIZE > nobj * obj_size) chunk_size = nobj * obj_size - i * MTHCA_TABLE_CHUNK_SIZE;  table->icm[i] = mthca_alloc_icm(dev, chunk_size >> PAGE_SHIFT, 
struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev,					      u64 virt, int obj_size,					      int nobj, int reserved,					      int use_lowmem){	struct mthca_icm_table *table;	int num_icm;	int i;	u8 status;	num_icm = obj_size * nobj / MTHCA_TABLE_CHUNK_SIZE;	table = kmalloc(sizeof *table + num_icm * sizeof *table->icm, GFP_KERNEL);	if (!table)		return NULL;	table->virt     = virt;	table->num_icm  = num_icm;	table->num_obj  = nobj;	table->obj_size = obj_size;	table->lowmem   = use_lowmem;	init_MUTEX(&table->mutex);	for (i = 0; i < num_icm; ++i)		table->icm[i] = NULL;	for (i = 0; i * MTHCA_TABLE_CHUNK_SIZE < reserved * obj_size; ++i) {		table->icm[i] = mthca_alloc_icm(dev, MTHCA_TABLE_CHUNK_SIZE >> PAGE_SHIFT,						(use_lowmem ? GFP_KERNEL : GFP_HIGHUSER) |						__GFP_NOWARN);		if (!table->icm[i])			goto err;		if (mthca_MAP_ICM(dev, table->icm[i], virt + i * MTHCA_TABLE_CHUNK_SIZE,				  &status) || status) {			mthca_free_icm(dev, table->icm[i]);			table->icm[i] = NULL;			goto err;		}		/*		 * Add a reference to this ICM chunk so that it never		 * gets freed (since it contains reserved firmware objects).		 */		++table->icm[i]->refcount;	}	return table;err:	for (i = 0; i < num_icm; ++i)		if (table->icm[i]) {			mthca_UNMAP_ICM(dev, virt + i * MTHCA_TABLE_CHUNK_SIZE,					MTHCA_TABLE_CHUNK_SIZE >> 12, &status);			mthca_free_icm(dev, table->icm[i]);		}	kfree(table);	return NULL;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/d20a40192868082eff6fec729b311cb8463b4a21/mthca_memfree.c/buggy/drivers/infiniband/hw/mthca/mthca_memfree.c