Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: zfcp: Move the position of put_device()

Place the put_device() call after device_unregister() in both
zfcp_unit_remove() and zfcp_sysfs_port_remove_store() to make it more
natural. put_device() ought to be the last time we touch the object in both
functions.

Add comments after put_device() to make code clearer.

Link: https://lore.kernel.org/r/0a568c7733ba0f1dde28b0c663b90270d44dd540.1618417667.git.bblock@linux.ibm.com
Suggested-by: Steffen Maier <maier@linux.ibm.com>
Suggested-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Qinglang Miao and committed by
Martin K. Petersen
be46e39a 20540a56

+4 -4
+2 -2
drivers/s390/scsi/zfcp_sysfs.c
··· 327 327 list_del(&port->list); 328 328 write_unlock_irq(&adapter->port_list_lock); 329 329 330 - put_device(&port->dev); 331 - 332 330 zfcp_erp_port_shutdown(port, 0, "syprs_1"); 333 331 device_unregister(&port->dev); 332 + 333 + put_device(&port->dev); /* undo zfcp_get_port_by_wwpn() */ 334 334 out: 335 335 zfcp_ccw_adapter_put(adapter); 336 336 return retval ? retval : (ssize_t) count;
+2 -2
drivers/s390/scsi/zfcp_unit.c
··· 255 255 scsi_device_put(sdev); 256 256 } 257 257 258 - put_device(&unit->dev); 259 - 260 258 device_unregister(&unit->dev); 259 + 260 + put_device(&unit->dev); /* undo _zfcp_unit_find() */ 261 261 262 262 return 0; 263 263 }