if (SCtmp->host_scribble) { kfree(SCtmp->host_scribble); SCtmp->host_scribble = NULL; } 
kfree(SCtmp->host_scribble); SCtmp->host_scribble = NULL; 
static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id, struct pt_regs *regs){	void (*my_done) (Scsi_Cmnd *) = NULL;	int errstatus, mbi, mbo, mbistatus;	int number_serviced;	unsigned long flags;	Scsi_Cmnd *SCtmp;	int flag;	int needs_restart;	struct mailbox *mb;	struct ccb *ccb;	mb = HOSTDATA(shost)->mb;	ccb = HOSTDATA(shost)->ccb;#ifdef DEBUG	{		flag = inb(INTRFLAGS(shost->io_port));		printk(KERN_DEBUG "aha1542_intr_handle: ");		if (!(flag & ANYINTR))			printk("no interrupt?");		if (flag & MBIF)			printk("MBIF ");		if (flag & MBOA)			printk("MBOF ");		if (flag & HACC)			printk("HACC ");		if (flag & SCRD)			printk("SCRD ");		printk("status %02x\n", inb(STATUS(shost->io_port)));	};#endif	number_serviced = 0;	needs_restart = 0;	while (1 == 1) {		flag = inb(INTRFLAGS(shost->io_port));		/* Check for unusual interrupts.  If any of these happen, we should		   probably do something special, but for now just printing a message		   is sufficient.  A SCSI reset detected is something that we really		   need to deal with in some way. */		if (flag & ~MBIF) {			if (flag & MBOA)				printk("MBOF ");			if (flag & HACC)				printk("HACC ");			if (flag & SCRD) {				needs_restart = 1;				printk("SCRD ");			}		}		aha1542_intr_reset(shost->io_port);		spin_lock_irqsave(&aha1542_lock, flags);		mbi = HOSTDATA(shost)->aha1542_last_mbi_used + 1;		if (mbi >= 2 * AHA1542_MAILBOXES)			mbi = AHA1542_MAILBOXES;		do {			if (mb[mbi].status != 0)				break;			mbi++;			if (mbi >= 2 * AHA1542_MAILBOXES)				mbi = AHA1542_MAILBOXES;		} while (mbi != HOSTDATA(shost)->aha1542_last_mbi_used);		if (mb[mbi].status == 0) {			spin_unlock_irqrestore(&aha1542_lock, flags);			/* Hmm, no mail.  Must have read it the last time around */			if (!number_serviced && !needs_restart)				printk(KERN_WARNING "aha1542.c: interrupt received, but no mail.\n");			/* We detected a reset.  Restart all pending commands for			   devices that use the hard reset option */			if (needs_restart)				aha1542_restart(shost);			return;		};		mbo = (scsi2int(mb[mbi].ccbptr) - (SCSI_BUF_PA(&ccb[0]))) / sizeof(struct ccb);		mbistatus = mb[mbi].status;		mb[mbi].status = 0;		HOSTDATA(shost)->aha1542_last_mbi_used = mbi;		spin_unlock_irqrestore(&aha1542_lock, flags);#ifdef DEBUG		{			if (ccb[mbo].tarstat | ccb[mbo].hastat)				printk(KERN_DEBUG "aha1542_command: returning %x (status %d)\n",				       ccb[mbo].tarstat + ((int) ccb[mbo].hastat << 16), mb[mbi].status);		};#endif		if (mbistatus == 3)			continue;	/* Aborted command not found */#ifdef DEBUG		printk(KERN_DEBUG "...done %d %d\n", mbo, mbi);#endif		SCtmp = HOSTDATA(shost)->SCint[mbo];		if (!SCtmp || !SCtmp->scsi_done) {			printk(KERN_WARNING "aha1542_intr_handle: Unexpected interrupt\n");			printk(KERN_WARNING "tarstat=%x, hastat=%x idlun=%x ccb#=%d \n", ccb[mbo].tarstat,			       ccb[mbo].hastat, ccb[mbo].idlun, mbo);			return;		}		my_done = SCtmp->scsi_done;		if (SCtmp->host_scribble) {			kfree(SCtmp->host_scribble);			SCtmp->host_scribble = NULL;		}		/* Fetch the sense data, and tuck it away, in the required slot.  The		   Adaptec automatically fetches it, and there is no guarantee that		   we will still have it in the cdb when we come back */		if (ccb[mbo].tarstat == 2)			memcpy(SCtmp->sense_buffer, &ccb[mbo].cdb[ccb[mbo].cdblen],			       sizeof(SCtmp->sense_buffer));		/* is there mail :-) */		/* more error checking left out here */		if (mbistatus != 1)			/* This is surely wrong, but I don't know what's right */			errstatus = makecode(ccb[mbo].hastat, ccb[mbo].tarstat);		else			errstatus = 0;#ifdef DEBUG		if (errstatus)			printk(KERN_DEBUG "(aha1542 error:%x %x %x) ", errstatus,			       ccb[mbo].hastat, ccb[mbo].tarstat);#endif		if (ccb[mbo].tarstat == 2) {#ifdef DEBUG			int i;#endif			DEB(printk("aha1542_intr_handle: sense:"));#ifdef DEBUG			for (i = 0; i < 12; i++)				printk("%02x ", ccb[mbo].cdb[ccb[mbo].cdblen + i]);			printk("\n");#endif			/*			   DEB(printk("aha1542_intr_handle: buf:"));			   for (i = 0; i < bufflen; i++)			   printk("%02x ", ((unchar *)buff)[i]);			   printk("\n");			 */		}		DEB(if (errstatus) printk("aha1542_intr_handle: returning %6x\n", errstatus));		SCtmp->result = errstatus;		HOSTDATA(shost)->SCint[mbo] = NULL;	/* This effectively frees up the mailbox slot, as							   far as queuecommand is concerned */		my_done(SCtmp);		number_serviced++;	};}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c9475cb0c358ff0dd473544280d92482df491913/aha1542.c/clean/drivers/scsi/aha1542.c