out_unmap: 
out_release_irq: free_irq(ms->meshintr, ms); out_shutdown: /* shutdown & reset bus in case of error or macos can be confused * at reboot if the bus was set to synchronous mode already */ mesh_shutdown(mdev); set_mesh_power(ms, 0); pci_free_consistent(macio_get_pci_dev(mdev), ms->dma_cmd_size, ms->dma_cmd_space, ms->dma_cmd_bus); out_unmap: 
static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match){	struct device_node *mesh = macio_get_of_node(mdev);	struct pci_dev* pdev = macio_get_pci_dev(mdev);	int tgt, *cfp, minper;	struct mesh_state *ms;	struct Scsi_Host *mesh_host;	void *dma_cmd_space;	dma_addr_t dma_cmd_bus;	switch (mdev->bus->chip->type) {	case macio_heathrow:	case macio_gatwick:	case macio_paddington:		use_active_neg = 0;		break;	default:		use_active_neg = SEQ_ACTIVE_NEG;	}	if (macio_resource_count(mdev) != 2 || macio_irq_count(mdev) != 2) {       		printk(KERN_ERR "mesh: expected 2 addrs and 2 intrs"	       	       " (got %d,%d)\n", mesh->n_addrs, mesh->n_intrs);		return -ENODEV;	}	if (macio_request_resources(mdev, "mesh") != 0) {       		printk(KERN_ERR "mesh: unable to request memory resources");		return -EBUSY;	}       	mesh_host = scsi_host_alloc(&mesh_template, sizeof(struct mesh_state));	if (mesh_host == NULL) {		printk(KERN_ERR "mesh: couldn't register host");		goto out_release;	}		/* Old junk for root discovery, that will die ultimately */#if !defined(MODULE)       	note_scsi_host(mesh, mesh_host);#endif	mesh_host->base = macio_resource_start(mdev, 0);	mesh_host->irq = macio_irq(mdev, 0);       	ms = (struct mesh_state *) mesh_host->hostdata;	macio_set_drvdata(mdev, ms);	ms->host = mesh_host;	ms->mdev = mdev;	ms->pdev = pdev;		ms->mesh = ioremap(macio_resource_start(mdev, 0), 0x1000);	if (ms->mesh == NULL) {		printk(KERN_ERR "mesh: can't map registers\n");		goto out_free;	}			ms->dma = ioremap(macio_resource_start(mdev, 1), 0x1000);	if (ms->dma == NULL) {		printk(KERN_ERR "mesh: can't map registers\n");		iounmap(ms->mesh);		goto out_free;	}       	ms->meshintr = macio_irq(mdev, 0);       	ms->dmaintr = macio_irq(mdev, 1);       	/* Space for dma command list: +1 for stop command,       	 * +1 to allow for aligning.	 */	ms->dma_cmd_size = (mesh_host->sg_tablesize + 2) * sizeof(struct dbdma_cmd);	/* We use the PCI APIs for now until the generic one gets fixed	 * enough or until we get some macio-specific versions	 */	dma_cmd_space = pci_alloc_consistent(macio_get_pci_dev(mdev),					     ms->dma_cmd_size,					     &dma_cmd_bus);	if (dma_cmd_space == NULL) {		printk(KERN_ERR "mesh: can't allocate DMA table\n");		goto out_unmap;	}	memset(dma_cmd_space, 0, ms->dma_cmd_size);	ms->dma_cmds = (struct dbdma_cmd *) DBDMA_ALIGN(dma_cmd_space);       	ms->dma_cmd_space = dma_cmd_space;	ms->dma_cmd_bus = dma_cmd_bus + ((unsigned long)ms->dma_cmds)		- (unsigned long)dma_cmd_space;	ms->current_req = NULL;       	for (tgt = 0; tgt < 8; ++tgt) {	       	ms->tgts[tgt].sdtr_state = do_sdtr;	       	ms->tgts[tgt].sync_params = ASYNC_PARAMS;	       	ms->tgts[tgt].current_req = NULL;       	}	if ((cfp = (int *) get_property(mesh, "clock-frequency", NULL)))       		ms->clk_freq = *cfp;	else {       		printk(KERN_INFO "mesh: assuming 50MHz clock frequency\n");	       	ms->clk_freq = 50000000;       	}       	/* The maximum sync rate is clock / 5; increase       	 * mesh_sync_period if necessary.	 */	minper = 1000000000 / (ms->clk_freq / 5); /* ns */	if (mesh_sync_period < minper)		mesh_sync_period = minper;	/* Power up the chip */	set_mesh_power(ms, 1);	/* Set it up */       	mesh_init(ms);	/* XXX FIXME: error should be fatal */       	if (request_irq(ms->meshintr, do_mesh_interrupt, 0, "MESH", ms))	       	printk(KERN_ERR "MESH: can't get irq %d\n", ms->meshintr);	/* XXX FIXME: handle failure */	scsi_add_host(mesh_host, &mdev->ofdev.dev);	scsi_scan_host(mesh_host);	return 0;out_unmap:	iounmap(ms->dma);	iounmap(ms->mesh);out_free:	scsi_host_put(mesh_host);out_release:	macio_release_resources(mdev);	return -ENODEV;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/0cdc82ee1ae36c1ae4631fc3a782faeb0b90df38/mesh.c/buggy/drivers/scsi/mesh.c