iscsi_add_session() warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looking at this:

drivers/scsi/scsi_transport_iscsi.c: In function 'iscsi_add_session':
drivers/scsi/scsi_transport_iscsi.c:703: warning: 'err' may be used uninitialized in this function

the compiler is wrong - `err' will always have been initialised to
_something_.

But to what?

: int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id)
: {
: 	struct Scsi_Host *shost = iscsi_session_to_shost(session);
: 	struct iscsi_cls_host *ihost;
: 	unsigned long flags;
: 	unsigned int id = target_id;
: 	int err;
: 
: 	ihost = shost->shost_data;
: 	session->sid = atomic_add_return(1, &iscsi_session_nr);
: 
: 	if (id == ISCSI_MAX_TARGET) {
: 		for (id = 0; id < ISCSI_MAX_TARGET; id++) {
: 			err = device_for_each_child(&shost->shost_gendev, &id,
: 						    iscsi_get_next_target_id);
: 			if (!err)
: 				break;
: 		}
: 
: 		if (id == ISCSI_MAX_TARGET) {
: 			iscsi_cls_session_printk(KERN_ERR, session,
: 						 "Too many iscsi targets. Max "
: 						 "number of targets is %d.\n",
: 						 ISCSI_MAX_TARGET - 1);

At this point, err is probably zero.  Or it might be the return value
from the most recent call to
device_for_each_child(iscsi_get_next_target_id).

Should we not assign some error code to `err' here?

: 			goto release_host;
: 		}
: 	}
: 	session->target_id = id;
: 
: 	dev_set_name(&session->dev, "session%u", session->sid);
: 	err = device_add(&session->dev);
: 	if (err) {
: 		iscsi_cls_session_printk(KERN_ERR, session,
: 					 "could not register session's dev\n");
: 		goto release_host;
: 	}
: 	transport_register_device(&session->dev);
: 
: 	spin_lock_irqsave(&sesslock, flags);
: 	list_add(&session->sess_list, &sesslist);
: 	spin_unlock_irqrestore(&sesslock, flags);
: 
: 	iscsi_session_event(session, ISCSI_KEVENT_CREATE_SESSION);
: 	return 0;
: 
: release_host:
: 	scsi_host_put(shost);
: 	return err;
: }

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux