Commit 0296bea
scsi: sd: Unregister device if device_add_disk() failed in sd_probe()
"if device_add() succeeds, you should call device_del() when you want to
get rid of it."
In sd_probe(), device_add_disk() fails when device_add() has already
succeeded, so change put_device() to device_unregister() to ensure device
resources are released.
Fixes: 2a7a891 ("scsi: sd: Add error handling support for add_disk()")
Signed-off-by: Li Nan <linan122@huawei.com>
Link: https://lore.kernel.org/r/20231208082335.1754205-1-linan666@huaweicloud.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>1 parent 6bc5e70 commit 0296bea
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3920 | 3920 | | |
3921 | 3921 | | |
3922 | 3922 | | |
3923 | | - | |
| 3923 | + | |
3924 | 3924 | | |
3925 | 3925 | | |
3926 | 3926 | | |
| |||
0 commit comments