if (SCtmp->host_scribble) { kfree(SCtmp->host_scribble); SCtmp->host_scribble = NULL; } 
kfree(SCtmp->host_scribble); SCtmp->host_scribble = NULL; 
static int aha1542_dev_reset(Scsi_Cmnd * SCpnt){	unsigned long flags;	struct mailbox *mb;	unchar target = SCpnt->device->id;	unchar lun = SCpnt->device->lun;	int mbo;	struct ccb *ccb;	unchar ahacmd = CMD_START_SCSI;	ccb = HOSTDATA(SCpnt->device->host)->ccb;	mb = HOSTDATA(SCpnt->device->host)->mb;	spin_lock_irqsave(&aha1542_lock, flags);	mbo = HOSTDATA(SCpnt->device->host)->aha1542_last_mbo_used + 1;	if (mbo >= AHA1542_MAILBOXES)		mbo = 0;	do {		if (mb[mbo].status == 0 && HOSTDATA(SCpnt->device->host)->SCint[mbo] == NULL)			break;		mbo++;		if (mbo >= AHA1542_MAILBOXES)			mbo = 0;	} while (mbo != HOSTDATA(SCpnt->device->host)->aha1542_last_mbo_used);	if (mb[mbo].status || HOSTDATA(SCpnt->device->host)->SCint[mbo])		panic("Unable to find empty mailbox for aha1542.\n");	HOSTDATA(SCpnt->device->host)->SCint[mbo] = SCpnt;	/* This will effectively							   prevent someone else from							   screwing with this cdb. */	HOSTDATA(SCpnt->device->host)->aha1542_last_mbo_used = mbo;	spin_unlock_irqrestore(&aha1542_lock, flags);	any2scsi(mb[mbo].ccbptr, SCSI_BUF_PA(&ccb[mbo]));	/* This gets trashed for some reason */	memset(&ccb[mbo], 0, sizeof(struct ccb));	ccb[mbo].op = 0x81;	/* BUS DEVICE RESET */	ccb[mbo].idlun = (target & 7) << 5 | (lun & 7);		/*SCSI Target Id */	ccb[mbo].linkptr[0] = ccb[mbo].linkptr[1] = ccb[mbo].linkptr[2] = 0;	ccb[mbo].commlinkid = 0;	/* 	 * Now tell the 1542 to flush all pending commands for this 	 * target 	 */	aha1542_out(SCpnt->device->host->io_port, &ahacmd, 1);	scmd_printk(KERN_WARNING, SCpnt,		"Trying device reset for target\n");	return SUCCESS;#ifdef ERIC_neverdef	/* 	 * With the 1542 we apparently never get an interrupt to	 * acknowledge a device reset being sent.  Then again, Leonard	 * says we are doing this wrong in the first place...	 *	 * Take a wait and see attitude.  If we get spurious interrupts,	 * then the device reset is doing something sane and useful, and	 * we will wait for the interrupt to post completion.	 */	printk(KERN_WARNING "Sent BUS DEVICE RESET to target %d\n", SCpnt->target);	/*	 * Free the command block for all commands running on this 	 * target... 	 */	for (i = 0; i < AHA1542_MAILBOXES; i++) {		if (HOSTDATA(SCpnt->host)->SCint[i] &&		    HOSTDATA(SCpnt->host)->SCint[i]->target == SCpnt->target) {			Scsi_Cmnd *SCtmp;			SCtmp = HOSTDATA(SCpnt->host)->SCint[i];			if (SCtmp->host_scribble) {				kfree(SCtmp->host_scribble);				SCtmp->host_scribble = NULL;			}			HOSTDATA(SCpnt->host)->SCint[i] = NULL;			HOSTDATA(SCpnt->host)->mb[i].status = 0;		}	}	return SUCCESS;	return FAILED;#endif				/* ERIC_neverdef */}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c9475cb0c358ff0dd473544280d92482df491913/aha1542.c/clean/drivers/scsi/aha1542.c