if (adapter) kfree(adapter); 
kfree(adapter); 
mraid_mm_register_adp(mraid_mmadp_t *lld_adp){	mraid_mmadp_t	*adapter;	mbox64_t	*mbox_list;	uioc_t		*kioc;	uint32_t	rval;	int		i;	if (lld_adp->drvr_type != DRVRTYPE_MBOX)		return (-EINVAL);	adapter = kmalloc(sizeof(mraid_mmadp_t), GFP_KERNEL);	if (!adapter) {		rval = -ENOMEM;		goto memalloc_error;	}	memset(adapter, 0, sizeof(mraid_mmadp_t));	adapter->unique_id	= lld_adp->unique_id;	adapter->drvr_type	= lld_adp->drvr_type;	adapter->drvr_data	= lld_adp->drvr_data;	adapter->pdev		= lld_adp->pdev;	adapter->issue_uioc	= lld_adp->issue_uioc;	adapter->timeout	= lld_adp->timeout;	adapter->max_kioc	= lld_adp->max_kioc;	adapter->quiescent	= 1;	/*	 * Allocate single blocks of memory for all required kiocs,	 * mailboxes and passthru structures.	 */	adapter->kioc_list	= kmalloc(sizeof(uioc_t) * lld_adp->max_kioc,						GFP_KERNEL);	adapter->mbox_list	= kmalloc(sizeof(mbox64_t) * lld_adp->max_kioc,						GFP_KERNEL);	adapter->pthru_dma_pool = pci_pool_create("megaraid mm pthru pool",						adapter->pdev,						sizeof(mraid_passthru_t),						16, 0);	if (!adapter->kioc_list || !adapter->mbox_list ||			!adapter->pthru_dma_pool) {		con_log(CL_ANN, (KERN_WARNING			"megaraid cmm: out of memory, %s %d\n", __FUNCTION__,			__LINE__));		rval = (-ENOMEM);		goto memalloc_error;	}	/*	 * Slice kioc_list and make a kioc_pool with the individiual kiocs	 */	INIT_LIST_HEAD(&adapter->kioc_pool);	spin_lock_init(&adapter->kioc_pool_lock);	sema_init(&adapter->kioc_semaphore, lld_adp->max_kioc);	mbox_list	= (mbox64_t *)adapter->mbox_list;	for (i = 0; i < lld_adp->max_kioc; i++) {		kioc		= adapter->kioc_list + i;		kioc->cmdbuf	= (uint64_t)(unsigned long)(mbox_list + i);		kioc->pthru32	= pci_pool_alloc(adapter->pthru_dma_pool,						GFP_KERNEL, &kioc->pthru32_h);		if (!kioc->pthru32) {			con_log(CL_ANN, (KERN_WARNING				"megaraid cmm: out of memory, %s %d\n",					__FUNCTION__, __LINE__));			rval = (-ENOMEM);			goto pthru_dma_pool_error;		}		list_add_tail(&kioc->list, &adapter->kioc_pool);	}	// Setup the dma pools for data buffers	if ((rval = mraid_mm_setup_dma_pools(adapter)) != 0) {		goto dma_pool_error;	}	list_add_tail(&adapter->list, &adapters_list_g);	adapters_count_g++;	return 0;dma_pool_error:	/* Do nothing */pthru_dma_pool_error:	for (i = 0; i < lld_adp->max_kioc; i++) {		kioc = adapter->kioc_list + i;		if (kioc->pthru32) {			pci_pool_free(adapter->pthru_dma_pool, kioc->pthru32,				kioc->pthru32_h);		}	}memalloc_error:	if (adapter->kioc_list)		kfree(adapter->kioc_list);	if (adapter->mbox_list)		kfree(adapter->mbox_list);	if (adapter->pthru_dma_pool)		pci_pool_destroy(adapter->pthru_dma_pool);	if (adapter)		kfree(adapter);	return rval;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c9475cb0c358ff0dd473544280d92482df491913/megaraid_mm.c/buggy/drivers/scsi/megaraid/megaraid_mm.c