On Tue, Jan 13, 2009 at 02:50:30PM +0100, Hannes Reinecke wrote: > @@ -1131,14 +1137,15 @@ EXPORT_SYMBOL(__scsi_device_lookup_by_target); > struct scsi_device *scsi_device_lookup_by_target(struct scsi_target *starget, > uint lun) > { > - struct scsi_device *sdev; > + struct scsi_device *sdev = NULL; > struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); > unsigned long flags; > > spin_lock_irqsave(shost->host_lock, flags); > - sdev = __scsi_device_lookup_by_target(starget, lun); > + restart: > + sdev = __scsi_device_lookup_by_target(starget, sdev, lun); > if (sdev && scsi_device_get(sdev)) > - sdev = NULL; > + goto restart; > spin_unlock_irqrestore(shost->host_lock, flags); > > return sdev; Backwards jumps are generally disapproved of. How about: spin_lock_irqsave(shost->host_lock, flags); for (;;) { sdev = __scsi_device_lookup_by_target(starget, sdev, lun); if (!sdev || !scsi_device_get(sdev)) break; } spin_unlock_irqrestore(shost->host_lock, flags); -- Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step." -- 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