Skip to content

Commit

Permalink
[SCSI] zfcp: proper use of device register
Browse files Browse the repository at this point in the history
Don't use kfree directly after device registration started.

Signed-off-by: Sebastian Ott <sebott@linux.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
Sebastian Ott authored and James Bottomley committed Sep 5, 2009
1 parent 24680de commit f4395b6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/s390/scsi/zfcp_aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,10 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun)
}
read_unlock_irq(&zfcp_data.config_lock);

if (device_register(&unit->sysfs_device))
goto err_out_free;
if (device_register(&unit->sysfs_device)) {
put_device(&unit->sysfs_device);
return ERR_PTR(-EINVAL);
}

if (sysfs_create_group(&unit->sysfs_device.kobj,
&zfcp_sysfs_unit_attrs)) {
Expand Down Expand Up @@ -675,8 +677,10 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
}
read_unlock_irq(&zfcp_data.config_lock);

if (device_register(&port->sysfs_device))
goto err_out_free;
if (device_register(&port->sysfs_device)) {
put_device(&port->sysfs_device);
goto err_out;
}

retval = sysfs_create_group(&port->sysfs_device.kobj,
&zfcp_sysfs_port_attrs);
Expand Down

0 comments on commit f4395b6

Please sign in to comment.