Zenghui Yu 1a0db7744e scsi: bsg: Fix device unregistration
device_initialize() is used to take a refcount on the device. However,
put_device() is not called during device teardown. This leads to a
leak of private data of the driver core, dev_name(), etc. This is
reported by kmemleak at boot time if we compile kernel with
DEBUG_TEST_DRIVER_REMOVE.

Fix memory leaks during unregistration and implement a release
function.

Link: https://lore.kernel.org/r/20210911105306.1511-1-yuzenghui@huawei.com
Fixes: ead09dd3aed5 ("scsi: bsg: Simplify device registration")
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-09-14 00:22:15 -04:00
..
2021-08-30 18:52:11 -07:00
2021-08-18 07:21:12 -06:00
2021-08-30 18:52:11 -07:00
2021-08-30 19:30:30 -07:00
2021-08-17 20:17:34 -06:00
2021-08-30 18:52:11 -07:00
2021-08-30 18:52:11 -07:00
2021-06-17 15:51:20 +02:00
2021-08-30 19:30:30 -07:00
2020-03-17 20:55:21 +01:00
2021-09-11 10:19:51 -07:00
2021-09-14 00:22:15 -04:00
2021-09-02 15:09:46 -07:00
2021-09-11 10:19:51 -07:00