Commit d56459d3 authored by Ming Lei's avatar Ming Lei Committed by Greg Kroah-Hartman
Browse files

scsi: sd: Free scsi_disk device via put_device()

[ Upstream commit 265dfe8ebbabae7959060bd1c3f75c2473b697ed ]

After a device is initialized via device_initialize() it should be freed
via put_device(). sd_probe() currently gets this wrong, fix it up.


Reviewed-by: default avatarBart Van Assche <>
Reviewed-by: default avatarChristoph Hellwig <>
Signed-off-by: default avatarMing Lei <>
Signed-off-by: default avatarMartin K. Petersen <>
Signed-off-by: default avatarSasha Levin <>
parent f117a356
......@@ -3146,15 +3146,16 @@ static int sd_probe(struct device *dev)
sdkp->dev.parent = dev;
sdkp->dev.parent = get_device(dev);
sdkp->dev.class = &sd_disk_class;
dev_set_name(&sdkp->dev, "%s", dev_name(dev));
error = device_add(&sdkp->dev);
if (error)
goto out_free_index;
if (error) {
goto out;
dev_set_drvdata(dev, sdkp);
get_device(&sdkp->dev); /* prevent release before async_schedule */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment