From: Christof Schmitt Date: Tue, 5 Oct 2010 15:12:54 +0000 (+0200) Subject: [SCSI] zfcp: Call get_device on port before calling put_device X-Git-Tag: v2.6.37-rc1~6^2~68 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a9708cd352e3b25500704daee9270d879e48199;p=profile%2Fivi%2Fkernel-x86-ivi.git [SCSI] zfcp: Call get_device on port before calling put_device zfcp_unit_release calls put_device on the port. Ensure that get_device has been called before possibly triggering the release function through put_device or device_unregister. Reviewed-by: Swen Schillig Signed-off-by: Christof Schmitt Signed-off-by: James Bottomley --- diff --git a/drivers/s390/scsi/zfcp_unit.c b/drivers/s390/scsi/zfcp_unit.c index 1119c53..20796eb 100644 --- a/drivers/s390/scsi/zfcp_unit.c +++ b/drivers/s390/scsi/zfcp_unit.c @@ -142,6 +142,8 @@ int zfcp_unit_add(struct zfcp_port *port, u64 fcp_lun) return -ENOMEM; } + get_device(&port->dev); + if (device_register(&unit->dev)) { put_device(&unit->dev); return -ENOMEM; @@ -152,8 +154,6 @@ int zfcp_unit_add(struct zfcp_port *port, u64 fcp_lun) return -EINVAL; } - get_device(&port->dev); - write_lock_irq(&port->unit_list_lock); list_add_tail(&unit->list, &port->unit_list); write_unlock_irq(&port->unit_list_lock);