From: Dan Carpenter Date: Mon, 19 Jan 2015 14:41:12 +0000 (+0300) Subject: sd: fix an error return in probe() X-Git-Tag: v4.2-rc1~147^2~154 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dee0586e15d5d5796dd76bdc0ecfb7df7c5ee1c8;p=thirdparty%2Flinux.git 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 Reviewed-by: Tomas Henzl Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 7f9d65fe4fd9a..3b2fcb4fada04 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);