err = -ENOMEM; 
err = mthca_buddy_init(&dev->mr_table.mtt_buddy, fls(dev->limits.num_mtt_segs - 1)); if (err) goto err_mtt_buddy; 
int __devinit mthca_init_mr_table(struct mthca_dev *dev){	int err;	int i, s;	err = mthca_alloc_init(&dev->mr_table.mpt_alloc,			       dev->limits.num_mpts,			       ~0, dev->limits.reserved_mrws);	if (err)		return err;	err = -ENOMEM;	for (i = 1, dev->mr_table.max_mtt_order = 0;	     i < dev->limits.num_mtt_segs;	     i <<= 1, ++dev->mr_table.max_mtt_order)		; /* nothing */	dev->mr_table.mtt_buddy = kmalloc((dev->mr_table.max_mtt_order + 1) *					  sizeof (long *),					  GFP_KERNEL);	if (!dev->mr_table.mtt_buddy)		goto err_out;	for (i = 0; i <= dev->mr_table.max_mtt_order; ++i)		dev->mr_table.mtt_buddy[i] = NULL;	for (i = 0; i <= dev->mr_table.max_mtt_order; ++i) {		s = BITS_TO_LONGS(1 << (dev->mr_table.max_mtt_order - i));		dev->mr_table.mtt_buddy[i] = kmalloc(s * sizeof (long),						     GFP_KERNEL);		if (!dev->mr_table.mtt_buddy[i])			goto err_out_free;		bitmap_zero(dev->mr_table.mtt_buddy[i],			    1 << (dev->mr_table.max_mtt_order - i));	}	set_bit(0, dev->mr_table.mtt_buddy[dev->mr_table.max_mtt_order]);	for (i = 0; i < dev->mr_table.max_mtt_order; ++i)		if (1 << i >= dev->limits.reserved_mtts)			break;	if (i == dev->mr_table.max_mtt_order) {		mthca_err(dev, "MTT table of order %d is "			  "too small.\n", i);		goto err_out_free;	}	(void) mthca_alloc_mtt(dev, i);	return 0; err_out_free:	for (i = 0; i <= dev->mr_table.max_mtt_order; ++i)		kfree(dev->mr_table.mtt_buddy[i]); err_out:	mthca_alloc_cleanup(&dev->mr_table.mpt_alloc);	return err;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/9095e208d84c349193fa19245cd5a8bc1a9774b8/mthca_mr.c/clean/drivers/infiniband/hw/mthca/mthca_mr.c