summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-01-19 17:41:12 +0300
committerJames Bottomley <JBottomley@Odin.com>2015-05-25 08:46:24 -0700
commitdee0586e15d5d5796dd76bdc0ecfb7df7c5ee1c8 (patch)
tree818e7ca9d4371c2e402470e2e8be08d8eef22497 /drivers/scsi/sd.c
parentef10b16948bc0db51a0140be5109ad73b170a011 (diff)
downloadlinux-dee0586e15d5d5796dd76bdc0ecfb7df7c5ee1c8.tar.gz
linux-dee0586e15d5d5796dd76bdc0ecfb7df7c5ee1c8.tar.bz2
linux-dee0586e15d5d5796dd76bdc0ecfb7df7c5ee1c8.zip
sd: fix an error return in probe()
If device_add() fails then it should return the error code but instead the current code returns success. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: James Bottomley <JBottomley@Odin.com>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 7f9d65fe4fd9..3b2fcb4fada0 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2988,7 +2988,8 @@ static int sd_probe(struct device *dev)
sdkp->dev.class = &sd_disk_class;
dev_set_name(&sdkp->dev, "%s", dev_name(dev));
- if (device_add(&sdkp->dev))
+ error = device_add(&sdkp->dev);
+ if (error)
goto out_free_index;
get_device(dev);