sd: fix an error return in probe()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 19 Jan 2015 14:41:12 +0000 (17:41 +0300)
committerJames Bottomley <JBottomley@Odin.com>
Mon, 25 May 2015 15:46:24 +0000 (08:46 -0700)
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>
drivers/scsi/sd.c

index 7f9d65fe4fd9a441c1aa00f602f3dac14c866563..3b2fcb4fada0491c4500b42555fdef542b4399d2 100644 (file)
@@ -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);