iounmap(dev->regs.sa); 
int aac_sa_init(struct aac_dev *dev){	unsigned long start;	unsigned long status;	int instance;	const char *name;	instance = dev->id;	name     = dev->name;	/*	 *	Map in the registers from the adapter.	 */	if((dev->regs.sa = ioremap((unsigned long)dev->scsi_host_ptr->base, 8192))==NULL)	{			printk(KERN_WARNING "aacraid: unable to map ARM.\n" );		goto error_iounmap;	}	/*	 *	Check to see if the board failed any self tests.	 */	if (sa_readl(dev, Mailbox7) & SELF_TEST_FAILED) {		printk(KERN_WARNING "%s%d: adapter self-test failed.\n", name, instance);		goto error_iounmap;	}	/*	 *	Check to see if the board panic'd while booting.	 */	if (sa_readl(dev, Mailbox7) & KERNEL_PANIC) {		printk(KERN_WARNING "%s%d: adapter kernel panic'd.\n", name, instance);		goto error_iounmap;	}	start = jiffies;	/*	 *	Wait for the adapter to be up and running. Wait up to 3 minutes.	 */	while (!(sa_readl(dev, Mailbox7) & KERNEL_UP_AND_RUNNING)) {		if (time_after(jiffies, start+180*HZ)) {			status = sa_readl(dev, Mailbox7);			printk(KERN_WARNING "%s%d: adapter kernel failed to start, init status = %lx.\n", 					name, instance, status);			goto error_iounmap;		}		set_current_state(TASK_UNINTERRUPTIBLE);		schedule_timeout(1);	}	if (request_irq(dev->scsi_host_ptr->irq, aac_sa_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev ) < 0) {		printk(KERN_WARNING "%s%d: Interrupt unavailable.\n", name, instance);		goto error_iounmap;	}	/*	 *	Fill in the function dispatch table.	 */	dev->a_ops.adapter_interrupt = aac_sa_interrupt_adapter;	dev->a_ops.adapter_disable_int = aac_sa_disable_interrupt;	dev->a_ops.adapter_notify = aac_sa_notify_adapter;	dev->a_ops.adapter_sync_cmd = sa_sync_cmd;	dev->a_ops.adapter_check_health = aac_sa_check_health;	/*	 *	First clear out all interrupts.  Then enable the one's that 	 *	we can handle.	 */	sa_writew(dev, SaDbCSR.PRISETIRQMASK, 0xffff);	sa_writew(dev, SaDbCSR.PRICLEARIRQMASK, (PrintfReady | DOORBELL_1 | 				DOORBELL_2 | DOORBELL_3 | DOORBELL_4));	if(aac_init_adapter(dev) == NULL)		goto error_irq;	/*	 *	Start any kernel threads needed	 */	dev->thread_pid = kernel_thread((int (*)(void *))aac_command_thread, dev, 0);	if (dev->thread_pid < 0) {		printk(KERN_ERR "aacraid: Unable to create command thread.\n");		goto error_kfree;	}	/*	 *	Tell the adapter that all is configure, and it can start 	 *	accepting requests	 */	aac_sa_start_adapter(dev);	return 0;error_kfree:	kfree(dev->queues);error_irq:	sa_writew(dev, SaDbCSR.PRISETIRQMASK, 0xffff);	free_irq(dev->scsi_host_ptr->irq, (void *)dev);error_iounmap:	iounmap(dev->regs.sa);	return -1;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/8e0c5ebde82b08f6d996e11983890fc4cc085fab/sa.c/buggy/drivers/scsi/aacraid/sa.c