Skip to content

Commit

Permalink
scsi/sd: add error handling support for add_disk()
Browse files Browse the repository at this point in the history
We never checked for errors on add_disk() as this function
returned void. Now that this is fixed, use the shiny new
error handling.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
  • Loading branch information
mcgrof authored and intel-lab-lkp committed Jul 15, 2021
1 parent 3f86faa commit c1a87f2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/scsi/sd.c
Expand Up @@ -3485,7 +3485,11 @@ static int sd_probe(struct device *dev)
pm_runtime_set_autosuspend_delay(dev,
sdp->host->hostt->rpm_autosuspend_delay);
}
device_add_disk(dev, gd, NULL);

error = device_add_disk(dev, gd, NULL);
if (error)
goto out_free_index;

if (sdkp->capacity)
sd_dif_config_host(sdkp);

Expand Down

0 comments on commit c1a87f2

Please sign in to comment.