Skip to content

Commit

Permalink
[SCSI] zfcp: Call get_device on port before calling put_device
Browse files Browse the repository at this point in the history
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 <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Christof Schmitt authored and James Bottomley committed Oct 25, 2010
1 parent 0df1384 commit 1a9708c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/s390/scsi/zfcp_unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 1a9708c

Please sign in to comment.