Commit 9adc7b1e authored by Li Nan's avatar Li Nan
Browse files

scsi: sd: unregister device if device_add_disk() failed in sd_probe()

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8TPCX



----------------------------------------

"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: 2a7a891f ("scsi: sd: Add error handling support for add_disk()")
Signed-off-by: default avatarLi Nan <linan122@huawei.com>
parent ffaa81fb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment