}  sdev = scsi_alloc_sdev(starget, lun, hostdata); 
scsi_device_put(sdev); } else sdev = scsi_alloc_sdev(starget, lun, hostdata); 
static int scsi_probe_and_add_lun(struct scsi_target *starget,				  uint lun, int *bflagsp,				  struct scsi_device **sdevp, int rescan,				  void *hostdata){	struct scsi_device *sdev;	unsigned char *result;	int bflags, res = SCSI_SCAN_NO_RESPONSE, result_len = 256;	struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);	/*	 * The rescan flag is used as an optimization, the first scan of a	 * host adapter calls into here with rescan == 0.	 */	if (rescan) {		sdev = scsi_device_lookup_by_target(starget, lun);		if (sdev) {			SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO				"scsi scan: device exists on %s\n",				sdev->sdev_gendev.bus_id));			if (sdevp)				*sdevp = sdev;			else				scsi_device_put(sdev);			if (bflagsp)				*bflagsp = scsi_get_device_flags(sdev,								 sdev->vendor,								 sdev->model);			return SCSI_SCAN_LUN_PRESENT;		}	}	sdev = scsi_alloc_sdev(starget, lun, hostdata);	if (!sdev)		goto out;	result = kmalloc(result_len, GFP_ATOMIC |			((shost->unchecked_isa_dma) ? __GFP_DMA : 0));	if (!result)		goto out_free_sdev;	if (scsi_probe_lun(sdev, result, result_len, &bflags))		goto out_free_result;	/*	 * result contains valid SCSI INQUIRY data.	 */	if ((result[0] >> 5) == 3) {		/*		 * For a Peripheral qualifier 3 (011b), the SCSI		 * spec says: The device server is not capable of		 * supporting a physical device on this logical		 * unit.		 *		 * For disks, this implies that there is no		 * logical disk configured at sdev->lun, but there		 * is a target id responding.		 */		SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO					"scsi scan: peripheral qualifier of 3,"					" no device added\n"));		res = SCSI_SCAN_TARGET_PRESENT;		goto out_free_result;	}	res = scsi_add_lun(sdev, result, &bflags);	if (res == SCSI_SCAN_LUN_PRESENT) {		if (bflags & BLIST_KEY) {			sdev->lockable = 0;			scsi_unlock_floptical(sdev, result);		}		if (bflagsp)			*bflagsp = bflags;	} out_free_result:	kfree(result); out_free_sdev:	if (res == SCSI_SCAN_LUN_PRESENT) {		if (sdevp) {			if (scsi_device_get(sdev) == 0) {				*sdevp = sdev;			} else {				__scsi_remove_device(sdev);				res = SCSI_SCAN_NO_RESPONSE;			}		}	} else {		if (sdev->host->hostt->slave_destroy)			sdev->host->hostt->slave_destroy(sdev);		transport_destroy_device(&sdev->sdev_gendev);		put_device(&sdev->sdev_gendev);	} out:	return res;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/6f3a20242db2597312c50abc11f1e747c5d2326a/scsi_scan.c/buggy/drivers/scsi/scsi_scan.c