cmd->lun = lun; 
static int ub_sync_read_cap(struct ub_dev *sc, struct ub_capacity *ret){	struct ub_scsi_cmd *cmd;	char *p;	enum { ALLOC_SIZE = sizeof(struct ub_scsi_cmd) + 8 };	unsigned long flags;	unsigned int bsize, shift;	unsigned long nsec;	struct completion compl;	int rc;	init_completion(&compl);	rc = -ENOMEM;	if ((cmd = kmalloc(ALLOC_SIZE, GFP_KERNEL)) == NULL)		goto err_alloc;	memset(cmd, 0, ALLOC_SIZE);	p = (char *)cmd + sizeof(struct ub_scsi_cmd);	cmd->cdb[0] = 0x25;	cmd->cdb_len = 10;	cmd->dir = UB_DIR_READ;	cmd->state = UB_CMDST_INIT;	cmd->data = p;	cmd->len = 8;	cmd->done = ub_probe_done;	cmd->back = &compl;	spin_lock_irqsave(&sc->lock, flags);	cmd->tag = sc->tagcnt++;	rc = ub_submit_scsi(sc, cmd);	spin_unlock_irqrestore(&sc->lock, flags);	if (rc != 0) {		printk("ub: reading capacity: submit error (%d)\n", rc); /* P3 */		goto err_submit;	}	wait_for_completion(&compl);	if (cmd->error != 0) {		printk("ub: reading capacity: error %d\n", cmd->error); /* P3 */		rc = -EIO;		goto err_read;	}	if (cmd->act_len != 8) {		printk("ub: reading capacity: size %d\n", cmd->act_len); /* P3 */		rc = -EIO;		goto err_read;	}	/* sd.c special-cases sector size of 0 to mean 512. Needed? Safe? */	nsec = be32_to_cpu(*(__be32 *)p) + 1;	bsize = be32_to_cpu(*(__be32 *)(p + 4));	switch (bsize) {	case 512:	shift = 0;	break;	case 1024:	shift = 1;	break;	case 2048:	shift = 2;	break;	case 4096:	shift = 3;	break;	default:		printk("ub: Bad sector size %u\n", bsize); /* P3 */		rc = -EDOM;		goto err_inv_bsize;	}	ret->bsize = bsize;	ret->bshift = shift;	ret->nsec = nsec << shift;	rc = 0;err_inv_bsize:err_read:err_submit:	kfree(cmd);err_alloc:	return rc;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/f4800078d9ed4bd20b1b27f56e7b68cfa0d73038/ub.c/clean/drivers/block/ub.c